Language basics / Data types |
The DATETIME data type stores date and time data with time units from the year to fractions of a second.
DATETIME qual1 TO qual2
YEAR MONTH DAY HOUR MINUTE SECOND FRACTION
YEAR MONTH DAY HOUR MINUTE SECOND FRACTION FRACTION(1) FRACTION(2) FRACTION(3) FRACTION(4) FRACTION(5)
The DATETIME data type stores an instance in time, expressed as a calendar date and time-of-day.
The qual1 and qual2 qualifiers define the precision of the DATETIME variable. The precision can range from a year through a fraction of second.
DATETIME arithmetic is based on the INTERVAL data type, and can be combined with DATE values:
Left Operand Type | Operator | Right Operand Type | Result Type |
---|---|---|---|
DATETIME | - | DATETIME | INTERVAL |
DATETIME | - | DATE | INTERVAL |
DATETIME | - | INTERVAL | DATETIME |
DATETIME | + | INTERVAL | DATETIME |
The CURRENT operator provides current system date/time.
You can assign DATETIME variables with datetime literals with a specific notation.
DATETIME variables are initialized to NULL in functions, modules and globals.
DATETIME values can be converted to strings by the format YYYY-MM-DD hh:mm:ss.fffff.
MAIN DEFINE d1, d2 DATETIME YEAR TO MINUTE LET d1 = CURRENT YEAR TO MINUTE LET d2 = "1998-01-23 12:34" DISPLAY d1, d2 END MAIN