質問

I cannot seem to figure out why datetime does not work for me on some data I imported from CSV. I have a column, TIMESTAMP, which is of type datetime.

Select TIMESTAMP from GPS limit 1 <-This gives me a time, "6/29/2009 00:00:00" Select datetime(TIMESTAMP) from GPS limit 1 <- This gives me a pink field in SQLite manager, which seems empty. Select datetime('now') from GPS limit 1 <- This gives me the current date and time. ("2012-12-19 20:45:17") It is formatted differently than my other data - is there a datatype issue?

What is going on? Did my "Timestamp" data not actually get converted into a DATETIME object? Why is it stored as text? Is there a way to fix this?

役に立ちましたか?

解決

SQLite does not have a native date/time type; dates are stored either as numbers or as strings.

To be understood by SQLite's built-in date functions, date strings must have a format like yyyy-mm-dd hh:mm:ss.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top