最快的postgreSQL等同于MySQL UTC_DATE()(获取UTC日期)? [英] Fastest postgreSQL equivalent to MySQL UTC_DATE() (getting UTC date)?
本文介绍了最快的postgreSQL等同于MySQL UTC_DATE()(获取UTC日期)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新的postgreSQL和我的惊喜似乎没有单一的功能相当于 UTC_DATE()
从MySQL。
I am new to postgreSQL and to my surprise there appears to be no single function equivalent to UTC_DATE()
from MySQL.
我能够使用日期和时间的组合来获得期望的结果。时区功能,但我想知道什么是最快的方式来做到这一点。
I was able to get desired result using a combination of date & timezone functions but I am wondering what is the fastest way to do this.
我只想获得 UTC
推荐答案
使用PostgreSQL的时区功能:
Use the time zone capability of PostgreSQL:
SELECT
CAST(NOW() at time zone 'utc' AS date);
这篇关于最快的postgreSQL等同于MySQL UTC_DATE()(获取UTC日期)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文