Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

If I'm creating a date/datetime in a column in Sqlite, do I set it to anything other than 'Text' ?

0

57 views

Just getting into SQLite and I understand it does not use datatypes the same way as other languages. I'm building a database and it has to store date and time quite a lot. And I've read a lot about the date and time functions, etc, but I just want to make sure that in my CREATE script I shouldn't have anything other than

BirthDate TEXT
DateTime TEXT

asked February 20, 2011 9:57 pm CST
posted via StackOverflow

1 Answer

1
Best answer
 

I'm not sure exactly what your question is, but I think the below excerpt may prove to be useful

Taken from http://www.sqlite.org/datatype3.html

SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:

TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS"). REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar. INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC. Applications can chose to store dates and times in any of these formats and freely convert between formats using the built-in date and time functions.

answered February 20, 2011 10:23 pm CST

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
Indexing a TEXT column...
February 10, 2011
SQLite Date Query
January 30, 2011