为什么 SQL 时间戳不是 UTC?

Why is SQL Timestamp not UTC?

我 select 当前日期从 SQL 像这样:

foreach ($dbh->query('SELECT CURRENT_TIMESTAMP as `now`;') as $row) {
  echo $row['now'];
}

输出是这样的:2015-01-24 12:46:45。这是我电脑上的时间,在GMT-0500 (EST)。但是,我认为 SQL 时间戳应该总是在 UTC 中?为什么这个时间戳不是 UTC?

没有规定必须使用 UTC,相反请参阅文档(强调我的):

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_current-timestamp

Returns the current time as a value in 'HH:MM:SS' or HHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone.

有一个 UTC_TIMESTAMP() 函数可以获取 UTC 时间戳,您也可以使用 UNIX_TIMESTAMP() 函数(但这会给您不同的数据类型)。