superdate
superdate(
DATE
,
TIME
)

The superdate( function converts a regular date and a regular time into a superdate.

Parameters

This function has two parameters:

date – is a regular Panorama date (the number of days since January 1, 4713 B.C.). This date must be after 1904 A.D.

time – is a regular Panorama time (the number of seconds since midnight).

Description

The superdate( function converts a regular date and a regular time into a superdate. 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 its heyday, the Santa Fe Super Chief train would travel between Chicago and Los Angeles in 39 and1/2 hours. This example uses SuperDates to calculate the arrival time and day after the user enters the departure time.

    local Arrival,Departure,xTime
    xTime="7:30 pm"
    gettext "Departure Time",xTime
    Departure=superdate(today(),time(xTime))
    Arrival=Departure+superdate(0,time("39:30:00"))
    message "Arrives "+datepattern(regulardate(Arrival),"DayOfWeek")+
        " at "+timepattern(regulartime(Arrival),"hh:mm am/pm")

If the train leaves at 7:30 pm on Monday, the message will be Arrives Wednesday at 11:00 am. As you can see, SuperDate arithmetic is very easy, just add or subtract. There’s no need to worry about crossing midnight, because that simply is the start of a new day.

See Also

- calendardate( -- helps in creating monthly calendars.
- calendarday( -- helps in creating monthly calendars.
- converttimezone( -- converts a time or superdate from one time zone to another.
- Date Patterns -- control how dates are displayed or converted to text.
- date( -- converts text into a number representing a date.
- datepattern( -- converts a number representing a date into text. The function uses a pattern to control how the date is formatted (see Date Patterns).
- datevalue( -- converts integer values for year, month and day into a number representing a date.
- daylightsavingstimeoffset( -- returns the current daylight saving time offset of the specified time zone.
- dayofmonth( -- computes the day within a month.
- dayofquarter( -- computes the day within a quarter.
- dayofweek( -- computes the day of the week, with Sunday being 0, Monday 1, etc.
- dayofyear( -- computes the day within a quarter.
- dayvalue( -- extracts the day from a date as a numeric value.
- firstdayofweek( -- returns the user's preference for first day of the week.
- fixsuperdates -- fixes Panorama 6 SuperDates in current field.
- groupdatepattern( -- converts a number representing a date into text in a special format for use with the summarytable( and crosstab( functions. The function uses a pattern to control how the date is formatted (see Date Patterns).
- info("localtimezone") -- returns the local time zone for the current location of your computer.
- info("milliseconds") -- returns the number of milliseconds (1/1000th second) since the system started up.
- info("tickcount") -- returns the number of ticks (1/60th second) since the system started up.
- 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.
- longtimestr( -- converts a number to text in am/pm time format, including seconds.
- month1st( -- computes the first day of a month.
- monthlength( -- computes the length (number of days) of a month.
- monthmath( -- takes a date and computes the date that is one or more months before or after the original date.
- monthvalue( -- extracts the month from a date as a numeric value.
- naturaldate( -- converts a number representing a date into text using "natural" formatting.
- nextdaylightsavingstimetransition( -- returns the next date on which a transition to or from daylight savings time occurs.
- now( -- returns the current time (number of seconds since midnight).
- quarter1st( -- computes the first day of a quarter.
- quartervalue( -- extracts the quarter from a date as a numeric value.
- regulardate( -- extracts a regular date (number of days from January 1, 4713 B.C.) from a superdate.
- regulartime( -- extracts a regular time (seconds since midnight) from a superdate.
- secsminshours( -- this converts a time (number of seconds) into an approximate text value.
- superdatepattern( -- converts a number containing a superdate to text, allowing you to specify the patterns for both the date and the time conversion to text.
- SuperDates -- date and time combined into a single value.
- superdatesecondsstr( -- converts a number containing a superdate to text, including the seconds.
- superdatestr( -- converts a number containing a superdate (date + time) to text.
- superdateunixtime( -- converts a Panorama superdate into a 13 digit UNIX epoch date/time (including milliseconds).
- supernow( -- returns the number representing the current date and time as a superdate.
- texttimedifference( -- allows time math to be performed on text values.
- texttimeinterval( -- allows time math to be performed on text values.
- time( -- converts text into a number representing a time.
- time24( -- takes a time and makes sure it falls within a 24 hour period.
- timedifference( -- calculates the difference between two times. It works correctly even if the interval between the two times crosses over midnight.
- timeinterval( -- calculates the time interval between two times. It works correctly even if the interval between the two times crosses over midnight.
- timepattern( -- converts a number representing a time into text. The function uses a pattern to control how the time is formatted.
- timestr( -- converts a number to text in am/pm time format.
- timezoneabbreviation( -- returns the abbreviation of the specified time zone.
- timezonename( -- returns the continent and city of the specified time zone.
- today( -- returns a number corresponding to today's date.
- unixtimesuperdate( -- converts a 13 digit UNIX epoch date/time (including milliseconds) into a Panorama superdate.
- week1st( -- computes the first day of a week (Sunday).
- weekvalue( -- extracts the week from a date as a numeric value.
- year1st( -- computes the first day of a year.
- yearvalue( -- extracts the year from a date as a numeric value.

History

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