Module on Getting the Date & Time

Edvard Majakari edvard+news at majakari.net
Thu May 12 03:14:45 EDT 2005


Sara Khalatbari <sarapythonlist at yahoo.com> writes:

Hi,

> Is there a Modules in Python that returns the time &
> date of today when ran?

You mean a method in a module? Yes, there's good 'ol time module, which will
probably provide what you need:

>>> import time
>>> time.time()      # number of seconds (+ fract) elapsed after 01.01.1970
1115881981.3717401
>>> time.ctime()     # current time in string format
'Thu May 12 10:13:20 2005'
>>> time.localtime() # current time as a tuple
(2005, 5, 12, 10, 13, 30, 3, 132, 1)

For details, see 'pydoc time'

-- 
# Edvard Majakari		Software Engineer
# PGP PUBLIC KEY available    	Soli Deo Gloria!

$_ = '456476617264204d616a616b6172692c20612043687269737469616e20'; print
join('',map{chr hex}(split/(\w{2})/)),uc substr(crypt(60281449,'es'),2,4),"\n";



More information about the Python-list mailing list