Answer the question
In order to leave comments, you need to log in
How to get the current moment of a date in a random timezone?
Good afternoon!
Piece of code:
delta = 0
t = datetime.now() + timedelta(seconds=delta)
'%s+03:00' % t.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3]
'2018-02-15T15:49:22.413+03:00'
Answer the question
In order to leave comments, you need to log in
import pytz
tz = pytz.timezone('Europe/Berlin')
berlin_now = datetime.now(tz)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question