Date Format


#1

When inserting a new row into the table, how do you format the date?


#2

@davidfw1866,
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
http://stackoverflow.com/questions/19181715/cant-insert-date-into-sql-table


#3

Still having trouble with the format for this?
Are you supposed to use YYYYMMDD?


#4

I am not able to follow you guys, please tell me how to insert dates.


#5

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


#6

@rjmascolo
From
http://stackoverflow.com/questions/16739836/how-to-add-date-in-sqlite-database
Please read
http://www.sqlite.org/datatype3.html#section_2_2
and then
http://www.sqlite.org/lang_datefunc.html


#7

Hi,
I made the date field TEXT just like the name and entered it like this 'May 19th,1993' and it worked.


#8

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?


#9

@rjmascolo
In the introduction

The statements covered in this course, use SQLite Relational Database Management System (RDBMS).


#10

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.


#11

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.


#13