Created
August 25, 2009 09:44
-
-
Save simonw/174601 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime, time | |
| def to_isoformat(dt): | |
| return dt.isoformat().split('.')[0] | |
| def from_isoformat(s): | |
| s = s.split('.')[0] | |
| return datetime.datetime( | |
| *time.strptime(s, '%Y-%m-%dT%H:%M:%S')[:6] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment