Datetime Types

Use datetime data types to represent the date and time of day. Datetime values have these characteristics:

  • They’re specified with a relationship to UTC, or Universal Coordinated Time (formerly called Greenwich Mean Time or GMT). SQL-92 requires that every SQL session have a default offset from UTC that is used for the duration of the session. –8 hours is the normal time-zone offset of San Francisco, California, for example.

  • The natural rules of the Gregorian calendar determine how date values are formed. DBMSes reject values that they can’t recognize as dates.

  • Time values are based on a 24-hour clock, also called military time (use 13:00, not 1:00 P.M.).

  • Hyphens (-) separate the parts of a date, and colons (:) separate the parts ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.