python - Datetime - String Round Trip -
this question has answer here:
this gets me string. how go datetime object can date arithmetic , such?
from datetime import datetime, timezone s = datetime.now(timezone.utc).astimezone().isoformat()
this code snippet produces string happy with, how datetime
?
2015-11-01t07:49:35.106745-08:00
this works, lot busier see.
dt = datetime.strptime(s[:-3]+s[-2:], "%y-%m-%dt%h:%m:%s.%f%z") print(dt)
Comments
Post a Comment