如何在SQLite会话中设置时区? [英] How to Set timezone in session of SQLite?

查看:400
本文介绍了如何在SQLite会话中设置时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySql中,以下查询用于设置会话

In MySql following query is used to set session

set @@session.time_zone='+05:00';

但是它不适用于SQLite.

But it is not working into SQLite.

与下面的链接一样,无法在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:

选择DateTime('now','-5.30 hours');

select DateTime('now','-5.30 hours');

但是在会话中设置时区没有用.

but it is not useful to set timezone in session.

那么执行任何选择/插入查询时,是否可以在SQLite会话中设置时区?

So Is there any way to set timezone in session of SQLite when executing any select/insert query?

推荐答案

SQLite时间默认使用UTC,并且可以通过 localtime utc在UTC和当前本地时间之间进行转换日期和时间函数修饰符.但是,UTC与本地时间之间的时差是从操作系统读取的,无法更改.

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.

这篇关于如何在SQLite会话中设置时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆