TurboSQL Guide

Date Formats

Previous  Top  Next

TurboSQL offers two different notations for date literals. The native format is dd.mm.yyyy. This format is a very logical one and can not be mistaken by the parser for arithmetic calculations. For this reason, it is not necessary to enclose such a date literal in quotation marks. Example:

SELECT * FROM orders
WHERE saledate <= 31.12.2001

searches for sales on 31 December 2001.

If you prefer to enter the date in the American or international format, i.e. like 12/31/2001 or 2001-12-31 you have to enclose the date in single quotes and precede it with the keyword DATE:

SELECT * FROM orders
WHERE saledate <= DATE'12/31/2001'

or

SELECT * FROM orders
WHERE saledate <= DATE'2001-12-31'

The German format works as well:

SELECT * FROM orders
WHERE saledate <= DATE'31.12.2001'

Leading zeros for the month and day fields are optional. If the century is not specified for the year, TurboDB assumes the 20th century for years from 50 to 99 and the 21th century for years from 00 to 49.

You can omit the keyword DATE where the type of the string is obvious like in the above examples.

Example

SELECT *
FROM orders
WHERE (saledate > 1.1.89) AND (saledate <= 31.12.20)

searches for sales between the January 1st 1989 and the December 31 2020.