UNIX Date Conversion

Is there anything I’m overlooking in Pan X that would help me convert a UNIX date to a typical date and time format?

So far I’ve had little success in adding the UNIX date (seconds) to 1/1/1970 then converting it to a date pattern. My results have been all over the place.

A Unix date?

Seconds since when?

Since you want both date and time, I would suggest adding it to the superdate for 1/1/1970, and that should give you the superdate you are after.


If all you wanted was the date, you could divide the UNIX date by 86400 seconds per day, and add that to 1/1/1970.


I had to subtract 25180 from the unixDate to come out with the correct value.

let unixDate=val(shellscript("date +%s"))
let unixConstant= superdate(date("January 1,1970"),time("12:00 AM"))-25180
message superdatestr(unixConstant+unixDate)

25180 is the correction for your time zone. Your unixDate is Greenwich Mean Time.

Thanks guys. I was beating around the right bush but not quite getting there. - especially in trying to convert 1/1/1970 to the correct seconds. Now I can retrieve a time stamp and even convert it to the desired time zone.


I came across the need to convert to Panorama supertime to Unix time:
Convert Panorama supertime to Unix time: add 2082844800, which is the number of seconds between 1/1/1970 and 1/1/1904. They only differ by the year that they count from.
You also have to convert your local time to UTC. Panorama has a function for that, and functions for extracting dates.

That was true in Pan 6 but it remains unimplemented in Pan X.

You can use the converttimezone( function to adjust for time zones.

unixDateConstant=converttimezone(superdate(date("January 1,1970"),time("12:00 AM")),"UTC","")

This will adjust the unixDateConstant for the local time zone.