Datetime literals
Datetime literals define date/time value in an expression.
Syntax
DATETIME ( dtrep ) qual1 TO qual2[
(scale)]
where qual1 can be one of:
YEAR
MONTH
DAY
HOUR
MINUTE
SECOND
FRACTION
and qual2 can be one of:
YEAR
MONTH
DAY
HOUR
MINUTE
SECOND
FRACTION
FRACTION(1)
FRACTION(2)
FRACTION(3)
FRACTION(4)
FRACTION(5)
- dtrep is the datetime value representation in normalized format (YYYY-MM-DD hh:mm:ss.fffff).
- scale defines the number of significant digits of the fractions of a second.
- qual1 and qual2 qualifiers
define the precision of the
DATETIME
literal.
Usage
A datetime literal is specified with the DATETIME()
notation, and is typically
used in interval or datetime expressions, or to assign a DATETIME
variable.
In order to get the current date and time, use the CURRENT
operator.
Example
MAIN
DEFINE d1 DATETIME YEAR TO SECOND
DEFINE d2 DATETIME HOUR TO FRACTION(5)
LET d1 = DATETIME( 2002-12-24 23:55:56 ) YEAR TO SECOND
LET d2 = DATETIME( 23:44:55.34532 ) HOUR TO FRACTION(5)
END MAIN