Newbie: datetime conversion question
fredrik at pythonware.com
Tue Oct 17 15:00:29 CEST 2006
"kevin evans" wrote:
> I'm trying to convert some code from Ruby to Python, specifically..
> timestamp = "%08x" % Time.now.to_i
> Make a hex version of the current timestamp. Any ideas how best to do
> this in python gratefully received..
that's perfectly valid Python code, provided Time is an object that has a "now"
property which in turn has a "to_i" property.
but assuming that you don't have such an object, you can do something like:
timestamp = "%02x" % time.time()
More information about the Python-list