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

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -