I need to get the day of the week as integer.
If i use the following for day of the month mydate.day i would like to do the same for weekday. 
i tried mydate.weekday but this does not give me the integer (0 for sunday to 6 for saturday). 
Any suggestions?
 
                        
If you are using
datetime.datetime, usedatetime.datetime.weekdaymethod:You need to (... + 1) % 7 because the method return 0 for Monday, 6 for Sunday.
UPDATE
You can also use
datetime.datetime.isoweekdaywhich return 1 for Monday, 7 for Sunday.