SuperDates
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.

See Also

- Arithmetic Formulas -- mathematical operators and functions.
- Characters and Unicode Values -- working with individual characters of text.
- Constants -- values embedded into a formula.
- converttimezone( -- converts a time or superdate from one time zone to another.
- convertvariablestoconstants -- converts all of the variables in a formula into constant values.
- Date Arithmetic Formulas -- performing calculations on dates, and converting between dates and text.
- daylightsavingstimeoffset( -- returns the current daylight saving time offset of the specified time zone.
- Formula Workshop -- formula workshop wizard for testing and experimenting with formulas.
- formulacalc -- allows you to evaluate a formula that you were not able to code into the procedure when it was being written.
- formulafields( -- returns a list of fields used in a formula.
- formulaidentfiers( -- returns a list of identifiers (fields and variables) used in a formula.
- Formulas -- basics of formulas: components and grammar.
- formulavalue -- calculates the result of a formula. Usually this is done with an assignment statement (for example `x=2 * y` ), but the *formulavalue* statement gives you more flexibility. You can specify what database is to be used for the calculation (an assignment statement always uses the current database) and you can specify the formula using a variable, making it easy to change on the fly. This statement also gives you more control over how errors are handled.
- formulavariables( -- returns a list of variables used in a formula.
- Functions -- index of all functions available for use in Panorama formulas.
- info("localtimezone") -- returns the local time zone for the current location of your computer.
- info("timezoneabbreviations") -- returns a dictionary of time zone abbreviations supported by the system.
- info("timezones") -- returns a list of time zone regions recognized by the system.
- Linking with Another Database -- techniques for relating multiple database files so that they work together.
- makemergeformula( -- builds a formula from an “auto-wrap" style merge template.
- nextdaylightsavingstimetransition( -- returns the next date on which a transition to or from daylight savings time occurs.
- Non Decimal Numbers -- working with numbers in alternative (non-decimal) bases, including binary, octal and hexadecimal.
- Numbers -- Working with numeric values in a formula, and converting between numbers and text.
- Operators -- index of all operators available for use in Panorama formulas.
- Quotes -- text constants embedded into a formula
- Statements -- index of all statements available for use in Panorama procedures.
- Tag Parsing -- Panorama functions for working with text that contains data delimited by tags, including HTML.
- Text Formulas -- manipulating text with a formula (concatenation, extraction, rearranging, etc.)
- Time Arithmetic Formulas -- performing calculations on times, and converting between times and text.
- timezoneabbreviation( -- returns the abbreviation of the specified time zone.
- timezonename( -- returns the continent and city of the specified time zone.
- True/False Formulas -- logical boolean calculations.
- Using Fields in a Formula -- accessing database fields within a formula.
- Values -- the raw material that formulas work with -- numbers and text.
- Variables -- storing and retrieving individual items of data, not part of a database.

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0