1

I am currently working with a given time in the following format

"2022-03-21T12:14:28.725Z"

I want to compare this time I get from the internet to the local datetime.datetime.utcnow().timestamp() but I can't seem to get the conversion from string to unix timestamp right. Especially with the milliseconds.

I have already tried to use datetime.fromisoformat('2022-03-21T12:14:28.725Z') but no luck there.

To better understand my situation I am doing this to check the time off-set between a Server and my local machine.

Johnny
  • 13
  • 2
  • Does this answer your question? [How do I parse an ISO 8601-formatted date?](https://stackoverflow.com/questions/127803/how-do-i-parse-an-iso-8601-formatted-date) – FObersteiner Mar 22 '22 at 01:38

1 Answers1

0

Solution: How do I translate an ISO 8601 datetime string into a Python datetime object?

from dateutil import parser

parser.parse('2022-03-21T12:14:28.725Z')