问题
In MySql following query is used to set session
set @@session.time_zone='+05:00';
But it is not working into SQLite.
As on following link, It is not possible to set session in SQLite:
http://stackoverflow.com/questions/2013542/how-to-set-timezone-for-sql
We can select time according to zone as given in following query:
select DateTime('now','-5.30 hours');
but it is not useful to set timezone in session.
So Is there any way to set timezone in session of SQLite when executing any select/insert query?
回答1:
SQLite times use UTC by default, and can be converted between UTC and the current local time with the localtime and utc modifiers of the date and time functions.
However, the difference between UTC and the local time is read from the operating system, and cannot be changed.
来源:https://stackoverflow.com/questions/21756948/how-to-set-timezone-in-session-of-sqlite