views:

43

answers:

1

In the SQLite IDE SQL window, I've written the instruction to return the the equivalence of .NET DateTime.Now, which is CURRENT_TIMESTAMP.

Let's say it is 10:47:00 in local time, that is, GMT -4:00 (on summertime), otherwise it is GMT -5:00.

The result of my query:

select current_timestamp

returns 2010-09-23 14:47:00, regardless of my local machine time.

How can I make SQLite use my local time instead of GMT?

Thanks everyone! =)

+2  A: 

Use select datetime(current_timestamp, 'localtime');

You can get more info on the date/time functions here

Crassy
+1 - Very interesting! Thanks for this hint! =) I dindn't know about this, obviously. Besides, it is now returning 10:33:00, when it should return 11:33:00, because we're still on summertime in my corner of the world. Any clue?
Will Marcouiller
Seems that's not implemented. See the bottom of the page at http://www.sqlite.org/lang_datefunc.html for details. :)
Crassy
Yes, that's also what I have read, and it seems somewhat difficult to get the correct localtime due to this change of hour (EAT). Thanks! This answers my question. =)
Will Marcouiller