Using the TZ or _TZ environment variable to specify time zone

The C/C++ runtime library assumes times returned by the operating system are stored using Greenwich Mean Time (GMT) or Coordinated Universal Time (UTC). This time is referred to as the universal reference time. You can use the TZ or _TZ environment variable to specify information at run time. The C/C++ runtime library uses this information to map universal reference times to local times.

The TZ or _TZ environment variable has the following format.
TZ=standardHH[:MM[:SS]]
[daylight[HH[:MM[:SS:]]]
[,startdate[/starttime],enddate[/endtime]]]
The value of the TZ or _TZ environment variable has the following five fields (two required and three optional):
standard
An alphabetic abbreviation for the local standard time zone (for example, GMT, EST, MSEZ).
HH[:MM[:SS]]
The time offset westward from the universal reference time. A leading minus sign (-) means that the local time zone is east of the universal reference time. An offset of this form must follow standard and can also optionally follow daylight. An optional colon (:) separates hours from optional minutes and seconds.

If daylight is specified without a daylight offset, daylight savings time is assumed to be one hour ahead of the standard time.

[daylight]
The abbreviation for your local daylight savings time zone. If the first and third fields are identical, or if the third field is missing, daylight savings time conversion is disabled. The number of hours, minutes, and seconds your local daylight savings time is offset from UTC when daylight savings time is in effect. If the daylight savings time abbreviation is specified and the offset omitted, the offset of one hour is assumed.
[,startdate[/starttime],enddate[/endtime]]
A rule that identifies the start and end of daylight savings time, specifying when daylight savings time should be in effect. Both the startdate and enddate must be present and must either take the form Jn, n, or Mm.n.d where:
  • Jn is the Julian day n (1 <= n <=365) and does not account for leap days.
  • n is the zero-based Julian day (0 <= n <= 365). Leap days are counted; therefore, you can refer to February 29th.
  • For Mm.n.d, the d'th day of week n of month m of the year. Day is (0<=d<=6), with day 0 = Sunday, day 1 = Monday, and so on. Week is (1<=n<=5) where week 1 is the first week in which day d occurs and week 5 is the last occurrence of day d in the month (may actually be in week 4 or 5). Month is (1<=m<=12).

Neither starttime nor endtime are required, and when omitted, their values default to 02:00:00. If this daylight savings time rule is omitted altogether, the values in the rule default to the standard American daylight savings time rules starting at 02:00:00 the second Sunday in March and ending at 02:00:00 the first Sunday in November.