Dates and Times in SQLite

April 1, 2009

SQLite does note have a date-time type, however it can manipulate dates and times stored in several different formats. Specifically, dates can be stored as strings in the following forms:

  1. YYYY-MM-DD
  2. YYYY-MM-DD HH:MM
  3. YYYY-MM-DD HH:MM:SS
  4. YYYY-MM-DD HH:MM:SS.SSS
  5. YYYY-MM-DDTHH:MM
  6. YYYY-MM-DDTHH:MM:SS
  7. YYYY-MM-DDTHH:MM:SS.SSS
  8. HH:MM
  9. HH:MM:SS
  10. HH:MM:SS.SSS
  11. now
  12. DDDD.DDDD

See also: the thread Retrieving date on sqlite-users.