On 3/13/07, Astan Chee <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a string in this format "DD/MM/YYY" for example:
> tdate = "18/01/1990"
> and Im trying to convert this to epoch time, can anyone help?
import calendar
t = map(int,tdate.split('/'))
epochs = calendar.timegm((t[2], t[1], t[0], 0, 0, 0))
> Im also trying to convert that epoch time to the string format
> previously. Can anyone help this one too?
import time
time.ctime(epochs)
cheers,
amit.
--
----
Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
--
http://mail.python.org/mailman/listinfo/python-list