[Cppcms-users] sqlite3 CURRENT_TIMESTAMP compare to date_time
Brought to you by:
artyom-beilis
|
From: <ele...@ex...> - 2012-05-17 10:40:06
|
Hi,
Just a quick question.
Given a column in an sqlite database is set to DEFAULT CURRENT_TIMESTAMP,
which is stored in UTC, and not local time and an SQL SELECT such as
SELECT * FROM table WHERE created_at < ?
and a locale::date_time object representing current time, should date_time
be first converted to UTC before being sent to the SQL query?
ie.
ostringstream os;
os << as::ftime("%Y-%m-%d %H:%M:S") << as::timezone("UTC") << now;
1) Is this correct?
2) What if the column is not a timestamp but a date, and the query is
comparing date with date_time. Should conversion to UTC be still done?
Thanks,
Petr
|