2

i want to create a table on sqlite with one field as DateTime (YYYY-MM-DD) , how i can create it?

i'm trying with:

create table test (_date datetime);

but i'm not sure if the datatype is correct 'cause i can do this:

create table test (_date nyanType); 

and no error occours

Rafael Carrillo
  • 2,772
  • 9
  • 43
  • 64

1 Answers1

6

SQLite is rather unique in that its columns are not statically typed. You can technically store a string in a column that was created as an integer column.

If you check out the SQlite Documentation for types, you'll see that SQLite dosn't have a date type, but it exposes date and time functions that are suitable for manipulating dates that are stored as TEXT, REAL or INTEGER. You should use those instead.

rraawwrr
  • 193
  • 1
  • 6