mysql - UTC_TIMESTAMP() 是否受夏令时影响?

标签 mysql sql time timezone utc

我正在编写一个具有时间段预订系统的应用程序。用户可以处于不同的时区,因此我需要以 UTC 时间将值存储在数据库中。

我想知道 UTC_TIMESTAMP() 在 MySQL 中是如何计算的。靠谱吗?

如果服务器时区位于实行夏令时的区域,UTC_TIMESTAMP() 是否会始终正确运行,即使在由于夏令时导致的时间更改期间也是如此?

最佳答案

UTC 始终是 +0:00 - 它忽略夏令时,无论它是否有效。

在英国,当不使用夏令时时,我们使用 GMT (与 UTC 相同)。当我们观察夏令时时,我们有 BST为此。

Wikipeda 在 UTC 上是这样说的:

UTC does not change with a change of seasons, but local time or civil time may change if a time zone jurisdiction observes daylight saving time (summer time). For example, local time on the east coast of the United States is five hours behind UTC during winter, but four hours behind while daylight saving is observed there.

关于mysql - UTC_TIMESTAMP() 是否受夏令时影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17378476/

相关文章:

time - Swift 2 从 double 中获取分钟和秒

mysql - sql查询速度的问题

c# - 在 ADO.NET 中合并对两个数据库的查询

python - Python 中的实时中断

MySQL:表中的批量更新

sql - PostgreSQL,在插入之前检查重复项

ruby-on-rails - Rails Time Select,重新排列组件

MySQL通过多个外键进行查询

MySQL 检查 Varchar 日期是否在字符串日期之间

php - 使用 2 个查询的 Ajax PHP 更新