Search code examples
sqlitedateformathour

Sqlite format date from hour to hour


I want store in my sqlite database date in format DD/MM/YYYY HH:MM-HH:MM there is any solution of this ? I found only that YYYY-MM-DDTHH:MM answer.


Solution

  • SQLite has no specal data type for dates.

    You can store dates in any format you want, but if you want to use any of the built-in date functions, you have to use one of the supported date formats.

    What you want to store is not a date (a point in time), but a time interval. There is no built-in support for intervals; the best you can do is to store the start and the end of the interval in two separate columns.

    Please note that storing a date and displaying a date are two different things. It would be easier to compute the length of an interval when the two date values are stored in one of the numeric date formats.