Date Time Literal (SQL)

Help Contents


The SQL Date Time Literal defines a constant date, time of day, or timestamp.


primary-literal-datetime ::=
  | time-literal
  | timestamp-literal

date-literal ::=
  DATE ' unquoted-date-string '

time-literal ::=
  TIME ' unquoted-time-string '

timestamp-literal ::=
  TIMESTAMP ' unquoted-timestamp-string '


The DATE keyword introduces a constant date literal. You can use these formats for the unquoted-date-string:

Format Example
'yyyy' DATE '1976'
'yyyy-mm' DATE '1976-01'
'yyyy-mm-dd' DATE '1976-12-31'

The TIME keyword introduces a constant time of day literal. You can use these formats for the unquoted-time-string:

Format Example
'hh' TIME '12'
'hh:mm' TIME '12:45'
'hh:mm:ss' TIME '12:45:00'
'hh:mm:ss.fff' TIME '23:59:59.999'

The TIMESTAMP keyword introduces a constant timestamp literal. You can use these formats for the unquoted-timestamp-string:

Format Example
'yyyy' TIMESTAMP '1976'
'yyyy-mm' TIMESTAMP '1976-01'
'yyyy-mm-dd' TIMESTAMP '1976-12-31'
'yyyy-mm-dd hh' TIMESTAMP '1976-12-31 12'
'yyyy-mm-dd hh:mm' TIMESTAMP '1976-12-31 12:45'
'yyyy-mm-dd hh:mm:ss' TIMESTAMP '1976-12-31 12:45:00'
'yyyy-mm-dd hh:mm:ss.fff' TIMESTAMP '1976-12-31 23:59:59.999'

Further Information

Value Expressions (SQL)

To learn more about SQL scalar value expressions.

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.


For the meaning of terms used in Fernhill SCADA.