I'm having some troubles with Datetime formats. My database comes with this datetime format:
"2020-11-01T03:17:54Z"
Thing is that I just can't find the format that fits this string in order for me to convert it to a datetime object. I've gone all over the documentation but I just can´t find how to write the "T" or what the "Z" means.
Thanks in advance!
The date is in ISO 8601 format. If you try:
mydate = "2020-11-01T03:17:54Z"
mydate_updated = pd.to_datetime(mydate)
you will see that this format includes the info "tz='UTC'":
Timestamp('2020-11-01 03:17:54+0000', tz='UTC')
You can remove it (but keep that the date is in UTC) as follows:
mydate_updated = pd.to_datetime(mydate).tz_localize(None)
The result will be the timestamp:
Timestamp('2020-11-01 03:17:54')