Finding out the weekday

Jorge Godoy godoy at
Wed Mar 26 01:03:25 CET 2003

Alex Martelli <aleax at> writes:

> 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).

This is exactly what I was looking for.

I had found the other answers (weekday[6]...)  before, but I wanted to
see if there was something more interesting. It didn't occurred me to
look for 'calendar'... :-\

Godoy.     <godoy at>

More information about the Python-list mailing list