Search code examples
pythonpytz

python - Give UTC time get Time in Japan using pytz


Here is UTC time:

now_utc = datetime.datetime.now(timezone('UTC'))

Here is the time zone of Tokyo:

 tz = Asia/Tokyo

So...using pytz how to I get the local time on Japan?


Solution

  • This should work:

    now_utc.astimezone(timezone('Asia/Tokyo'))