0

I am trying to convert UTC time to local timezone (Asia/Calcutta).

Here is what i did:

next_date_time is a datetime format, 2019-07-11 13:12:14.240000

    tz = self._context.get('tz')
    localtz = pytz.timezone(tz)
    local_date = localtz.localize(next_date_time)
    print'local_date',local_date

And the output is 2019-07-11 13:12:14.240000+05:30. I can see the +5:30 here. But i need the output like

2019-07-11 18:42:14.240000

Is there any way to achieve this?

KbiR
  • 4,047
  • 6
  • 37
  • 103
  • Possible duplicate of [Convert a python UTC datetime to a local datetime using only python standard library?](https://stackoverflow.com/questions/4563272/convert-a-python-utc-datetime-to-a-local-datetime-using-only-python-standard-lib) – Flo Jul 11 '19 at 13:18
  • @KbiR see this https://stackoverflow.com/questions/4770297/convert-utc-datetime-string-to-local-datetime – Zaraki Kenpachi Jul 11 '19 at 13:24
  • 1
    @Flo, Thanks, it worked. – KbiR Jul 11 '19 at 13:58

0 Answers0