Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

starter is a naive datetime. Use pytz to make it a "US/Pacific" datetime instead and assign this converted datetime to the variable local.

import datetime
import pytz

pacific = pytz.timezone('US/Pacific')
fmt = '%m-%d %H:%M %Z%z'
utc = pytz.utc
start = pacific.localize(datetime.datetime(2015, 10, 21, 4, 29))
start_pacific = start.astimezone(pacific)
starter = datetime.datetime(2015, 10, 21, 4, 29)
starter_utc = datetime.datetime(2015, 10, 21, 4, 29, tzinfo=utc)
local = starter_utc.astimezone(pacific)
Comment

PREVIOUS NEXT
Code Example
Python :: ignore transformers warning 
::  
Python ::  
Python ::  
::  
::  
Python ::  
Python :: create line in canvas widget object 
Python :: change text color in jupyter notebook 
::  
Python :: python group groupe of 2 
Python ::  
::  
Python ::  
::  
:: how to restore windows security 
Python ::  
Python :: python numpy bbox 
:: python crear variables 
Python ::  
Python ::  
::  
:: vars() python 
:: python move 
Python ::  
::  
Python :: c to python converter 
Python ::  
::  
Python ::  
ADD CONTENT
Topic
Content
Source link
Name
3+1 =