jfk83
jfk83

Reputation: 810

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;

Upvotes: 1

Views: 154

Answers (1)

marekful
marekful

Reputation: 15351

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. E.g.

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

Upvotes: 1

Related Questions