[sf-lug] unix time conversion
chgros at coverity.com
Mon Oct 27 16:07:50 PDT 2008
> Got it!
> Now that you have wetted my appetite:
> How to change a human readable time into 'unix time?'
> (preferably using python so this becomes applicable to the ThinkPython grp)
>>>> string = "July 3, 1945"
>>>> import time
> the above doesn't work but is it just because the format of the date is incorrect or is there a bigger problem?
Unfortunately, parsing a human-readable date is much harder than
time() is not a parsing function (it just returns the current time in
Python apparently has a time parsing function, strptime (presumably
based on the posix one), but I wasn't able to make it work.
It's definitely not a beginner kind of problem.
More information about the sf-lug