Time
HMS Surprise
john at datavoiceint.com
Mon May 14 10:00:06 EDT 2007
Thanks for posting. I sure am sorry that I wasted your time. I should
have started the post stating I am using jython 2.2.3 and apparently
it has no datetime module. But I will keep datetime in mind for future
reference.
Since I had no datetime I cobbled out the following. Seems to work
thus far. Posted here for the general amusement of the list.
Regards,
jvh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from time import *
s = '05/11/2007 1:23 PM'
t = s.split()
mdy = t[0].split('/')
hrMn = t[1].split(':')
if t[2] == 'PM':
hrMn[0] = int(hrMn[0]) + 12
tuple =(int(mdy[2]), int(mdy[0]), int(mdy[1]), hrMn[0], int(hrMn[1]),
0,0,0,0)
print tuple
eTime = mktime(tuple)
print 'eTime', eTime
More information about the Python-list
mailing list