Answers for "python timestamp with timezone"

26

datetime python

from datetime import datetime as d
date = d.now()
print(date.strftime("%Y-%m-%d %H:%M:%S"))
Posted by: Guest on December-09-2020
0

how to convert time from one timezone to another in python

from datetime import datetime
from pytz import timezone
format = "%Y-%m-%d %H:%M:%S %Z%z"
# Current time in UTC
now_utc = datetime.now(timezone('UTC'))
print(now_utc.strftime(format))
# Convert to Asia/Kolkata time zone
now_asia = now_utc.astimezone(timezone('Asia/Kolkata'))
print(now_asia.strftime(format))
Posted by: Guest on August-31-2020
-1

python datetime from timestamp utc

dt_object = datetime.fromtimestamp(timestamp)
Posted by: Guest on August-05-2020
0

how to convert time from one timezone to another in python

$ pip install pytz
Posted by: Guest on August-31-2020

Code answers related to "python timestamp with timezone"

Python Answers by Framework

Browse Popular Code Answers by Language