Reputation: 5594
I have a .csv file that has a column filled with dates and times in the format "2011-07-29 12:00:00". When I open it in notepad or wordpad this is how I see it. However when I open it in excel, it shows up as "7/29/2011 12:00:00". I imported this .csv into a SQLite database using
CREATE TABLE myTable (_id PRIMARY INTEGER KEY, dateTime TEXT, blah BLAH...);
.separator ","
.import myCsv.csv myTable
And now, not only is my database formatted with the slashes, but also the seconds are gone. I.e., it looks like "7/29/20011 12:00". Why does this happen and how do I fix this? I need it in the "2011-07-29 12:00:00" format!
Upvotes: 3
Views: 6010
Reputation: 1
change the format to YYYY-MM-DD HH:MM:SS in excel- column formatting and save as CSV and then import. it should work
Upvotes: 0
Reputation: 31182
Read the Date and Time Datatype documentation for sqlite3.
You can solve your problem in 2 steps:
Upvotes: 3