简体   繁体   中英

MySQL get time of a specific timezone

I need to get the time of a specific timezone using MySQL.

I tried using CONVERT_TZ , but it takes 3 arguments, is there any other MySQL function which will return time instead of converting time from one timezone to another?

Either of these will work:

Option 1:

SET time_zone = 'America/New_York';
SELECT NOW();

Option 2:

SELECT CONVERT_TZ(UTC_TIMESTAMP(),'UTC','America/New_York');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM