[Tutor] Query
Magnus Lyckå
magnus@thinkware.se
Wed May 28 22:27:03 2003
At 14:07 2003-05-23 +0530, Dasgupta, Pallavi (Pallavi) wrote:
>Hello,
>
>How do I get the timestamp using time() in python script?
>Please give an example.
>>> import time
>>> time.time()
1054175047.052
>>> # That's seconds since 1970-01-01 00:00:00
>>> time.asctime()
'Thu May 29 04:24:37 2003'
>>> time.localtime()
(2003, 5, 29, 4, 24, 43, 3, 149, 1)
>>> # Or with mxBase
>>> from mx.DateTime import now
>>> now()
<DateTime object for '2003-05-29 04:25:29.38' at f97c88>
>>> print now()
2003-05-29 04:25:34.76
>>> print now().Format('%m/%d/%Y %H:%M')
05/29/2003 04:26
--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program