portable method for getting system date & time?

Alex Martelli aleax at aleax.it
Wed Jan 29 22:46:37 CET 2003


Sam Marrocco wrote:

[nothing, but the question is presumably in the subject]

in what form to you want to "get" them?  Standard module time
has quite a few ways to return them to you.  E.g.:

 
>>> import time
>>> print time.asctime()
Wed Jan 29 22:45:20 2003
>>>

this is local time in string form, while, e.g.:

>>> print time.time()
1043876744.4
>>>

this is UTC time in seconds since an arbitrary epoch -- and so
on, and so forth.  Say in what form you want this, and module
time probably has a solution (quite portable too).


Alex





More information about the Python-list mailing list