client.geo.utc_offset

Time zone offset from coordinated universal time (UTC) for client.geo.city.

Values may be negative. Values are given as base-10 numbers of three or four digits in the form (-)HHMM or (-)HMM where H is hours and M is minutes. For example, -230 would be offset of minus two hours and thirty minutes from UTC.

This may be formatted to an ISO 8601 four-digit form (-)HHMM by VCL:

1
2
declare local var.offset STRING;
set var.offset = regsub(client.geo.utc_offset, "^(-?)(...)$", "\10\2");

The special value 0 is used to indicate absent data, and the special value 9999 to indicate an invalid region.

Not all timezone offsets are on the hour. For example, in St. John's, Newfoundland, client.geo.utc_offset may be -230 or -330 (depending on daylight savings time). The following VCL fragment produces a value in units of hours:

1
2
3
4
5
declare local var.offset_by_hour FLOAT;
set var.offset_by_hour = client.geo.utc_offset;
set var.offset_by_hour %= 100;
set var.offset_by_hour /= 60; # minutes
set var.offset_by_hour += std.atoi(regsub(client.geo.utc_offset, "..$", "")); # truncate

Here increments of 0.5 correspond to half hours. For example, an offset of 930 will produce a floating point value of 9.5.

Type

INTEGER

Accessibility

Read Only

Readable From

All subroutines