Converting timeZones


#1

Hey, i am storing for each document a DateTime field in UTC timezone,
I want to group in cycles of times but in varied timezones (format e.g. GMT-08:00 , GMT+01:00 , …).
I’ve seen the Date functions for N1QL.
specifically: MILLIS_TO_ZONE_NAME(expression, tz_name [, fmt ]) which Converts the UNIX time stamp to a string in the named time zone, but what is the “named time zone” ? how do i convert the time from UTC to other timezone using the format i mentioned?
in MySQL i would do something like this :
GROUP BY UNIX_TIMESTAMP(CONVERT_TZ(dateTime, ‘GMT+02:00’’))/(cycle * 3600)"
How can i do something equivalent in N1QL?
In addition if i’m doing such a grouping in N1QL, how much would it slow down my query?
Thanks for the helpers.


#2

Hi,

The zone name is the common name of the time zone, e.g. PDT or EST or UTC.

Otherwise, it is taken from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones and https://golang.org/pkg/time/#Location .