Newbie: datetime conversion question

skip at pobox.com skip at pobox.com
Tue Oct 17 15:11:27 CEST 2006


    kevin> I'm trying to convert some code from Ruby to Python,
    kevin> specifically..

    kevin> timestamp = "%08x" % Time.now.to_i

    kevin> Make a hex version of the current timestamp. Any ideas how best
    kevin> to do this in python gratefully received..

Try

    import time
    timestamp = hex(int(time.time()))

Skip



More information about the Python-list mailing list