How to maintain the dateonly field

sqlite

Hello I have a table in Postgres and one of the fields is type Date with the format '2019-09-10' and I'm transferring this table into a SQLite one BUT in this SQLite I'm getting this field as Date with this format 'Fri Sept 13 2019 00:00:00 GMT+0000 (UTC)' and I don't want that I just want it to be as in the Postgres table '2019-09-13'

this is the DDL of the Postgres:

CREATE TABLE public."Checks" (
    "customerId" int4 NOT NULL,
    "checkDate" date NULL
);

and this is the DDL for the SQLite:

CREATE TABLE `Checks` (`customerId` INTEGER NOT NULL NOT NULL, `checkDate` DATE);

Best Answer

SQLite only supports some datatypes, and DATE is not one of them (https://sqlite.org/datatype3.html).

SQLite version 3.28.0 2019-04-16 19:49:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE `Checks` (`customerId` INTEGER NOT NULL NOT NULL, `checkDate` DATE);
sqlite> insert into Checks values (1,1);
sqlite> insert into Checks values (2,'08-09-2019');
sqlite> insert into Checks values (3,'2019-09-08');
sqlite> insert into Checks values (4,'eight september 2019');
sqlite> insert into Checks values (5,'there is no checking if this really is a date!');
sqlite> select * from checks;
1|1
2|08-09-2019
3|2019-09-08
4|eight september 2019
5|there is no checking if this really is a date!
sqlite>