I have a data frame with a date time string in UCT in the following format:
2022-06-05T07:01:00.000Z
I am trying to convert the date time string to local time (GMT+3).
I have tried few methods but with no luck. Can you please help.
I have a data frame with a date time string in UCT in the following format:
2022-06-05T07:01:00.000Z
I am trying to convert the date time string to local time (GMT+3).
I have tried few methods but with no luck. Can you please help.
Be so kind, read documentation first: https://docs.python.org/3.10/library/datetime.html
As the documentation suggested, you have to use https://dateutil.readthedocs.io/en/stable/parser.html#dateutil.parser.isoparse rather than original fromisoformat
https://docs.python.org/3.10/library/datetime.html#datetime.datetime.fromisoformat
It will return datetime
so that will provide you an option to replace timezone like so: .replace(tzinfo=timezone.utc).astimezone(tz=None)
.