YouTip LogoYouTip

Att Time Tzset

# Python2.x Python time tzset() Method * * * ## Description The Python time tzset() function reinitializes time-related settings based on the TZ environment variable. Standard TZ environment variable format: std offset [dst [offset [,start, end]]] ## Parameters * **std and dst:** Three or more letter abbreviation for the time. Passed to time.tzname. * **offset:** Offset from UTC, format: [+|-]hh[:mm[:ss]] {h=0-23, m/s=0-59}. * **start, end:** The date when DST takes effect. The format is m.w.d β€” representing the month, week number, and day of the month. w=1 refers to the first week of the month, while w=5 refers to the last week of the month. 'start' and 'end' can be in one of the following formats: * **Jn:** Julian day n (1 <= n <= 365). Leap day (February 29) is not counted. * **n:** Julian day (0 <= n <= 365). Leap day (February 29) is counted. * **Mm.n.d:** Month, week number, and day of the month. w=1 refers to the first week of the month, while w=5 refers to the last week of the month. * **time:** (Optional) The time when DST takes effect (24-hour format). The default is 02:00 (local time of the specified timezone). ## Syntax time.tzset() ## Parameters * NA. ## Return Value This function does not return a value. ## Example The following example demonstrates the usage of the tzset() function: #!/usr/bin/pythonimport time import os os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0' time.tzset()print time.strftime('%X %x %Z') os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0' time.tzset()print time.strftime('%X %x %Z') The output of the above example is: 13:00:40 02/17/09 EST 05:00:40 02/18/09 AEDT
← Bootstrap V2 ButtonsAtt Time Time β†’