Stefan Antonelli wrote: > Hi, > > i have to convert several timestamps. The given format, eg "yyyy-mm-dd > hh:mm:ss" > has to be converted to an epoch string. Is there any proper way to do this? > > If not, i have to split the given string and resolve this by a calculation? > > Thanks for help. > > Stefan.
I saw some code on the net. ASPB I think. I whacked a few more lines to be an example. #!/usr/bin/env python import httplib import time ht = httplib.HTTP('www.python.org') fich='/index.html' print fich, ht.putrequest('GET', fich) ht.endheaders() errcode, errmsg, headers = ht.getreply() print headers.dict print headers.dict['server'] textoFecha=headers.dict['date'] print textoFecha fecha = time.strptime(textoFecha,'%a, %d %b %Y %H:%M:%S %Z') print fecha print time.asctime(fecha) print time.mktime(fecha) print "===" fecha = time.strptime('2006-12-15 19:42','%Y-%m-%d %H:%M') print fecha print time.asctime(fecha) print time.mktime(fecha) -- http://mail.python.org/mailman/listinfo/python-list