Date/Time/Timestamp Data, Part 1 of 2
Date, time, and timestamp data is represented by the following:
> The SQL standard requires that the date, time, and timestamp are maintained internally based on Universal Coordinated Time (UCT) which used to be called Greenwich Mean Time (GMT). Then an offset is applied for your location. For example, New York has an offset of -5, Dallas has -6, Denver has -7, and Los Angeles has -8.
These change for daylight savings time in the U.S.
> The date is based on the rules of the Gregorian calendar. A hyphen (-) separates the parts of the date. The standard SQL date has the keyword DATE ahead of the date literal, such as DATE ’2056-02-20′.
> The time is based on a 24-hour clock, just like military time, so 17:00 is the same as 5:00 PM. A colon (:) separates the parts of time such as TIME ’17:30:45′.
> A timestamp is a combination of date and time such as TIMESTAMP ’2056-02-20 17:30:45′.
> A space is used to separate date and time when both are present.
> You can compare two DATE, TIME, or TIMESTAMP values if they are of the same format.
> SQL can not handle dates that are Before the Common Era (BCE) or Before Christ (BC).
> Access surrounds date-time literals with the pound sign (#), so that the standard SQL date
DATE ’2056-02-20′ is the same as the Microsoft Access’ #2056-02-20#.
> DB2 & SQL Server omit the key word DATE, TIME, and TIMESTAMP ahead of the literal.
> The external representation may be set to ISO, USA, EUR, or JIS. We use ISO in our examples.