Created
          September 7, 2012 12:05 
        
      - 
      
- 
        Save kitsunde/3665628 to your computer and use it in GitHub Desktop. 
    pytz working for Singapore
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | >>> import pytz | |
| >>> from datetime import datetime | |
| >>> time_zone = pytz.timezone('Asia/Singapore') | |
| >>> my_time = datetime.utcnow() | |
| >>> my_time | |
| datetime.datetime(2012, 9, 7, 12, 6, 15, 56631) | |
| >>> my_time.replace(tzinfo=pytz.utc) | |
| datetime.datetime(2012, 9, 7, 12, 6, 15, 56631, tzinfo=<UTC>) | |
| >>> my_time = my_time.replace(tzinfo=pytz.utc) | |
| >>> my_time.astimezone(time_zone) | |
| datetime.datetime(2012, 9, 7, 20, 6, 15, 56631, tzinfo=<DstTzInfo 'Asia/Singapore' SGT+8:00:00 STD>) | |
| >>> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
thanks!