Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

converting timezones

import datetime as dt
import pytz

timezone_nw = pytz.timezone('America/New_York')
nw_datetime_obj = dt.datetime.now(timezone_nw)

timezone_london = pytz.timezone('Europe/London')
london_datetime_obj = nw_datetime_obj.astimezone(timezone_london)


print('America/New_York:', nw_datetime_obj)
print('Europe/London:', london_datetime_obj)
Comment

PREVIOUS NEXT
Code Example
Python :: length of queue python 
Python :: create an empty list in python 
Python :: google youtuve api 
Python :: Python NumPy delete Function Example 
Python :: Lambda Functions using for loop 
Python :: map dataframe 
Python :: start virtualenv with python version 
Python :: gil python 
Python :: length of list in python 
Python :: Routes In Django 
Python :: how to add new column in django 
Python :: fastest way to iterate dictionary python 
Python :: Code example of Python Modulo Operator 
Python :: python print new line 
Python :: create a new column in pandas dataframe based on the existing columns 
Python :: get user api 
Python :: how to delete whole list in python 
Python :: get min of list python 
Python :: python and flask create_app 
Python :: python Parse string into integer 
Python :: python decimal 
Python :: how to import packages in python 
Python :: python modules list 
Python :: get column names and and index dataframe 
Python :: python youtube downloader (Downloading multiple videos) 
Python :: python add encoding for non-English language like Arabic 
Python :: python selenium class 
Python :: Add one to a column pands 
Python :: how to increment datetime by custom months in python 
Python :: matplotlib smooth loss curves 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =