When inserting a new row into the table, how do you format the date?
Here an example
found with a google search
When inserting a new row into the table, how do you format the date? site:stackoverflow.com
Still having trouble with the format for this?
Are you supposed to use YYYYMMDD?
I am not able to follow you guys, please tell me how to insert dates.
Still not understanding how to insert the date. Right now I am doing this:
CREATE TABLE friends (id INTEGER, name TEXT, birthday DATE);
INSERT INTO friends (id, name, birthday) VALUES (1,'Jane Doe', 1993-05-19);
But the table is give me back the value 1969
I made the date field TEXT just like the name and entered it like this 'May 19th,1993' and it worked.
So looking at the second link the answer is:
SQLite does not have a storage class set aside for storing dates and/or times
How are we supposed to know we are using SQL Lite?
In the introduction
The statements covered in this course, use SQLite Relational Database Management System (RDBMS).
hi! i struggled with this one too, i found out that this worked:
CREATE TABLE friends (id integer, name text, birthday date);
INSERT INTO friends (id, name, birthday) VALUES (1, "Jane Doe", "1993-05-19");
SELECT * FROM friends;
remember to put between double quotes the date, or it will perform the following calculation: 1993 - 05 - 19 = 1969.
So essentially the date in this case is just a text string? Indicating it is a DATE does not seem to do anything as I have to put quotes around it to not have it perform a math function and once the quotes are around it you can enter anything. Currently Jane's birth date for me is 'pickles'. Seems useless to me.