Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ISO8601ToEpoch(theString):
- from datetime import datetime
- import calendar
- return calendar.timegm(datetime.strptime(theString, "%Y-%m-%dT%H:%M:%S.%f").timetuple())
- def EpochToISO8601(theEpoch):
- from datetime import datetime
- return datetime.fromtimestamp(theEpoch).isoformat()
- #
- print 'Original Time {0}'.format('2018-04-27T04:19:51.050937')
- theTime=ISO8601ToEpoch('2018-04-27T04:19:51.050937')
- print 'Time {0}'.format(theTime)
- print 'Original Time {0}'.format(EpochToISO8601(theTime)
Add Comment
Please, Sign In to add comment