How to Set timezone in session of SQLite?

感情迁移 提交于 2019-12-13 07:44:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!