How to Insert Date in SQLite

1

I have a query: I have a table in SQLite with this structure

CREATE TABLE [Agenda] (
[Itinerario] VARCHAR(50)  NULL,
[Creado] TIMESTAMP  NULL,
[Fecha] TIMESTAMP  NULL   )

And I'm trying to enter rows with the following SQL statement:

INSERT INTO Agenda VALUES ('Ir de Compras','23-08-2016 12:00','24-08-2016 18:00');

But the dates are entered incorrectly.

What should I be doing wrong?

PS: I'm testing these questions from the sqliteadmin since my project is in .NET but it does not take dates well from there either.

    
asked by Agustin M. 23.08.2016 в 19:01
source

1 answer

3

SQLite supports the following date formats:

YYYY-MM-DD
YYYY-MM-DD HH:MM
YYYY-MM-DD HH:MM:SS
YYYY-MM-DD HH:MM:SS.SSS
YYYY-MM-DDTHH:MM
YYYY-MM-DDTHH:MM:SS
YYYY-MM-DDTHH:MM:SS.SSS
HH:MM
HH:MM:SS
HH:MM:SS.SSS
now
DDDDDDDDDD 

Your format is 24-08-2016 18:00 is DD-MM-YYYY HH:MM which is not supported.

Solution:

Change the format of the date you are entering to: 2016-08-24 18:00

Reference: link

    
answered by 23.08.2016 / 19:11
source