简体   繁体   中英

MySQL tz_convert utc returning null?

I was using tz_convert() function from MySQL and I am getting Null.

Is this normal. I was reading that is bug ?

SELECT CONVERT_TZ('2004-01-01 12:00:00','PST','UTC') as date;

Using timezone or location names in MySQL convert_tz() is dependant on how the system timezone database is configured. If you know the offsets, pass them in '+00:00' format instead of tz names. That should work regardless of the system configuration. Eg

SELECT CONVERT_TZ('2004-01-01 12:00:00','-08:00','+00:00') as date;

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