View Source Timex.Parse.Timezones.Posix (timex v3.7.11)

Parses POSIX-style timezones:

format

Format

POSIX-style timezones are of the format: stdoffset[dst[offset][,start[/time],end[/time]]]

Where std/dst are dates in one of the following formats:

The Mm.n.d format, where:

  • Mm (1-12) for 12 months
  • n (1-5) 1 for the first week and 5 for the last week in the month
  • d (0-6) 0 for Sunday and 6 for Saturday

The Jn format, where n is the julian day and leap days are excluded.

Or the n format, where n is the julian day, and leap days are included.

Offsets are optional, except for the std offset, and can be preceded by a sign. The offset indicates the time added to the local time to obtain UTC time. The offsets may be hours; hours and minutes; and hours, minutes, and seconds - colon separated between components. NOTE: The sign of the offset is opposite the usual expectation, positive numbers are west of GMT, and negative numbers are east of GMT, this is because the offset is the time added to local time to arrive at UTC, rather than the other way around.

For more info, see: https://pubs.opengroup.org/onlinepubs/9699919799/

example

Example

TZ = CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00

This would represents a change to daylight saving time at 2:00 AM on the second Sunday in March and change back at 2:00 AM on the first Sunday in November, and keep 6 hours time offset from GMT every year. The breakdown of the string is:

  • CST6CDT is the timezone name (constructed by concatenating the abbreviation and offset of std/dst)
  • CST is the standard abbreviation
  • 6 is the offset from CST to get UTC
  • CDT is the DST abbreviation
  • There is no offset from CDT, so the standard assumes the offset is one hour ahead of CST, or 5
  • ,M3 is the third month
  • .2 is second week of the month
  • .0 is the day of the week (Sunday in this case)
  • /2:00:00 is the time at which CST changes to CDT; defaults to 2:00:00 if not specified
  • ,M11 is the eleventh month
  • .1 is the first week of the month
  • .0 is the day of the week
  • /2:00:00 is the time at which CDT changes back to CST; defaults to 2:00:00 if not specified

Link to this section Summary

Link to this section Functions