STR_TO_TZ returns null on Windows


#1

Hi,

I have a Couchbase installation (5.1) and am trying to convert dates between timezones. However, Couchbase cannot find the timezones based on the timezone names and is returning null.

SELECT STR_TO_TZ(‘2018-10-10T12:00:00Z’, ‘America/New_York’) as EST, STR_TO_TZ(‘2018-10-10T12:00:00Z’, ‘UTC’) as UTC;

[
{
“EST”: null,
“UTC”: “2018-10-10T12:00:00Z”
}
]

I understand that I am probably missing ta TZ_DATA file, but am not sure how/where to install this under Windows. Can anyone provide advice?

Brett


#2

Check this out https://github.com/golang/go/issues/21881

The solution is to ship the tzdata yourself (linked into your binary or elsewhere) and then call https://golang.org/pkg/time/#LoadLocationFromTZData.

Or set the %ZONEINFO% environment variable to point to your shipped zoneinfo.zip.