title: How to set timezone in python using os.environ
body: <p>example:</p>
  
  <pre>
  os.environ['TZ'] = "CST+06CDT,M4.1.0,M10.5.0"
  </pre>
  
  <p>I can understand CST, 06 (offset from UTC ?? or GMT) , CDT == Central Daylight Saving Time
  but </p>
  
  <p>What do M4.1.0 and M10.5.0 mean ? </p>
  
  <p>Here is what i found:</p>
  
  <p>export TZ=EST05EDT</p>
  
  <p>EST was taken from the chart below. Five hours has to be added to get UTC, hence the 05. And currently EDT, Eastern Daylight, is in effect.</p>
  
  <p>TZ=.</p>
  
  <p>DST timezones</p>
  
  <pre><code>  0      BST for British Summer.                                
    +400   ADT for Atlantic Daylight.                             
    +500   EDT for Eastern Daylight.                              
    +600   CDT for Central Daylight.                              
    +700   MDT for Mountain Daylight.                             
    +800   PDT for Pacific Daylight.                              
    +900   YDT for Yukon Daylight.                                
    +1000  HDT for Hawaii Daylight.                               
    -100   MEST for Middle European Summer,                       
               MESZ for Middle European Summer,                  
               SST for Swedish Summer and FST for French Summer. 
    -700   WADT for West Australian Daylight.                     
    -1000  EADT for Eastern Australian Daylight.                  
    -1200  NZDT for New Zealand Daylight.                         
  </code></pre>
  
  <p>Was there an easier way to get back to my correct time? Yes, just unset the TZ environment variable.</p>
  
  <pre><code>  $ unset TZ
    $ date
    Sun Aug 22 10:17:35 EDT 2004
  </code></pre>
  
  <p>Note, even though TZ was adjusted for daylight saving time, will you get the correct time 5 months from now? When does daylight saving time go into effect? The TZ value shown below adjust for dst, only during the correct dates. For instance, this entry goes into effect April, the first week, at 2am, and ends October the 5th week, at 2am. Note 10.5.0 stands for the 5th week in October, and not the 5th day.</p>
  
  <pre><code>  $ export TZ=EST+5EDT,M4.1.0/2,M10.5.0/2
  </code></pre>