DATETIME( ) Function Example

This first example stores the Datetime for the New Year to a variable named tNewyear, and stores the current Datetime to a variable named tToday. The number of seconds between the current Datetime and the New Year is then displayed.

The second example uses DATETIME( ) to create a year 2000-compliant DateTime value.

tNewyear = DATETIME(YEAR(DATE( ) ) + 1, 1, 1)  && Next New Year
tToday = DATETIME( )
nSecondstonewyear = tNewyear - tToday
CLEAR
? "There are " + ALLTRIM (STR(nSecondstonewyear)) ;
   + " seconds to the next New Year."

CLEAR
SET CENTURY ON
SET DATE TO AMERICAN
? DATETIME(1998, 02, 16, 12, 34, 56) && Displays 02/16/1998 12:34:56 PM