DATE (TSQL Datatype)

Stores a date.

Syntax

DATE

Range

0001-01-01T00:00:00 to 9999-12-31T23:59:59.999999999

Literal Date

There is no syntax for writing a literal date.

You just use a literal string, and it will be converted to date.

The best format to write a literal date are 'yyyyMMdd' and 'yyyy-MM-dd', as they are unambiguous.

Examples

DECLARE @a DATE = '19890302';          -- best format
DECLARE @b DATE = '1989-03-02';
DECLARE @c DATE = '19890302 09:30:00'; -- time part is ignored
DECLARE @d DATE = '';

PRINT @a;
PRINT @b;
PRINT @c;
PRINT @d;

The result is:

1989-03-02
1989-03-02
1989-03-02
1900-01-01