[Tutor] Crossfire problem
Kent Johnson
kent37 at tds.net
Sat May 21 00:06:40 CEST 2005
Alberto Troiano wrote:
> These are the commands I need from datetime module. Is there another way to
> get this info????
>
> hoy=datetime.datetime.now() # Today's date and time as a tuple
> dia=days[hoy.isoweekday()] # Today's dayweek as integer from 0 to 6
> grupo=datetime.datetime.today().strftime("%Y%m%d%H%M%S") # string today's
> date and time
These functions are all available in the time module which is older than datetime:
>>> import time
>>> hoy = time.localtime()
>>> hoy
(2005, 5, 20, 18, 1, 56, 4, 140, 1)
>>> hoy.tm_wday
4
>>> time.strftime("%Y%m%d%H%M%S")
'20050520180243'
> I was looking for the datetime module so I can copy it to the libraries of
> Python 2.3.4.
Google 'python datetime 2.2' for some alternatives.
Kent
More information about the Tutor
mailing list