-2

I'm trying to convert this string to a datetime object in Python. I don't understand the time part of the string '+00:00'. What does that mean and how do I format this string? '2021-01-04 04:00:00+00:00'

Thank you

Max Eisenhardt
  • 442
  • 2
  • 9
  • 20
  • It's mean timezone –  Dec 09 '21 at 13:59
  • Does this answer your question? [Convert UTC time to python datetime](https://stackoverflow.com/questions/13662789/convert-utc-time-to-python-datetime) – Chris Dec 09 '21 at 13:59

1 Answers1

1

From the documentation, that is the timezone indicator. +00:00 represents UTC.

The string format indicator for timezone is %z.

%z | UTC offset in the form ±HHMM[SS[.ffffff]] (empty string if the object is naive).

blackbrandt
  • 2,010
  • 1
  • 15
  • 32