TurboSQL Guide

Time Formats

Previous  Top  Next

TurboSQL offers two different notations for time literals. The native format expects time literals to be in the format HH:mm; where hh are the hours and mm the minutes. TurboSQL uses the 24 hour scale, that is 2:10 is in the early morning (2:10 AM) while 14:10 is in the early afternoon (2:10 PM). The time literal must not be enclosed in quotation marks.

INSERT INTO WorkOrder
(ID, StartTime)
VALUES ('B00120', 22:30)

If you prefer, you can enter the time value in the American format hh:mm:ss am/pm. In order to do this, you must enclose the time literal in single quotes and proceed it by the keyword TIME:

INSERT INTO WorkOrder
(ID, StartTime)
VALUES ('B00120', TIME'10:30:00 pm')

Where the type of the string is obvious like in the above example, you can omit the keyword TIME. An example where you can not omit it is this one:

SELECT StartTime - TIME'12:00:00 pm' FROM WorkOrder

Note
The first alternative with the native format without enclosing quotes cannot be used with the Delphi component TTdbQuery. The VCL parser for SQL commands recognizes the colon as the starting character of a parameter and creates an error message.