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


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0