[英]MySQL - Select date by different timezone
I've a database with a column of date in UTC timezone.我有一个包含 UTC 时区日期列的数据库。
Now I would like to preform a select query by different time zone (PST).现在我想按不同的时区 (PST) 执行选择查询。
Is this possible?这可能吗?
Thanks谢谢
Could have a column specifying the time zone and than execute sql stmt like this可以有一列指定时区,然后像这样执行 sql stmt
" SELECT timeZone, timeStamp
FROM tableName
WHERE timeZone='UTC' "
could pass a variable in the where clause like this, this is how id do it in php可以像这样在 where 子句中传递一个变量,这就是 id 在 php 中的做法
$TimeZone2Query = 'UTC';
" SELECT timeZone, timeStamp
FROM tableName
WHERE timeZone='$TimeZone2Query' "
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.