Finding out the weekday

Alex Martelli aleax at aleax.it
Tue Mar 25 21:16:54 CET 2003


Jorge Godoy wrote:

> Is there any Python module that given a particular date it returns me
> the day of the week? I'm needing it for some special calculations
> involving dates...

>>> import calendar
>>> calendar.weekday(2003,3,25)
1
>>> print calendar.weekday.__doc__
Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
       day (1-31).
>>>


Alex





More information about the Python-list mailing list