SuperDates combine the date and time into a single number…the number of seconds since January 1, 1904. SuperDates make it easy to calculate time intervals across multiple days. However, SuperDates take up more storage than regular dates, and are not as easy to work with. In addition, SuperDates are limited to dates after 1904. (In Panorama 6 and earlier versions, SuperDates were limited to dates between 1904 and 2040, but the 2040 limitation no longer applies to Panorama X. However, if you have a Panorama 6 database that contains SuperDates, you should use the fixsuperdates statement after converting the database to make sure that the values are correct in Panorama X.) Panorama has several functions for working with SuperDates.
superdate(date,time) This function converts a regular date and a regular time into a superdate. The date parameter is a regular Panorama date. This date must be after 1904 A.D. The time parameter is the number of seconds since midnight, usually computed with the seconds( or time( functions ([see Time Arithmetic Formulas). The result is a single value that combines both the date and time into a single number that can be used for multi-day calculations.
regulardate(number) This function extracts a regular date (number of days from January 1, 4713 B.C.) from a superdate. You can then format this date with the datepattern( function, as is shown in this example (which assumes that the field or variable Arrival contains a SuperDate value).
datepattern(regulardate(Arrival),"Month dd, yyyy")
regulartime(number) This function extracts a regular Panorama time (seconds since midnight) from a SuperDate. You can then format this date with the timepattern( function, as is shown in this example (which assumes that the field or variable Arrival contains a SuperDate value).
timepattern(regulartime(Arrival),"hh:mm am/pm")
superdatepattern(number, datepattern,timepattern) Converts a number containing a superdate to text, allowing you to specify the patterns for both the date and the time portions (see Date Patterns and timepattern(). For example the formula
superdatepattern(supernow(),"Month ddnth yyyy @ " ,"hh:mm am/pm")
will result in something like July 10th, 2008 @ 1:36 PM.
superdatesecondsstr(number) Converts a number containing a superdate to text in standard format including seconds (for example 4/20/03 9:56:37 AM).
superdatestr(number) Converts a number containing a superdate to text in standard format (for example 4/20/03 9:56 AM).
supernow() This function returns the number representing the current date and time as a superdate value (number).
converttimezone(time,fromzone,tozone) This function converts a day and time from one time zone to another. When this function is used to convert a superdate, it adjusts the day as well as the time (if needed). For example this formula
converttimezone(superdate(date("12/25/2020"),time("3:18 PM")),"New York","Sydney")
will result in the value 3691811880, which is Saturday, December 26th, 2020 @ 7:18:00 am.
When converting a superdate, the conversion will be adjusted for daylight savings time if needed. Thanks to clever code provided by Apple, the function knows on what dates each time zone starts and ends daylight savings time in different parts of the world.
Panorama also includes function to convert superdates to and from 13 digit UNIX epoch times (including milliseconds).
unixtimesuperdate(unixtime) This function converts a UNIX day and time into Panorama superdate format.
superdateunixtime(superdate) This function converts Panorama superdate format into a UNIX formatted date and time.
See Also
History
Version | Status | Notes |
10.0 | No Change | Carried over from Panorama 6.0 |