[sf-lug] unix time conversion

Jim Cortez jim at jimcortez.com
Mon Oct 27 16:38:32 PDT 2008


That is a pretty tough problem as it deals with natural language recognition. 
You can use something like http://labix.org/python-dateutil to try and parse 
several known representations of dates. Taking a machine-readable time and 
parsing into human readable is much easier.
Hope that helps!
Jim

On Monday 27 October 2008 4:02:52 pm Alex Kleider wrote:
> sorry, I should have written:
> >>> string = "July 3, 1945"
> >>> import time
> >>> unix_time = time(string)
> >>> print unix_time
> >
> > 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
> > >>> time(string)
> >
> > the above doesn't work but is it just because the
> > format of the date is incorrect or is there a bigger
> > problem?
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug





More information about the sf-lug mailing list