def weekday(self):
        """Returns the weekday of the date.

        The format is as in the time module: Monday is 0 and sunday is 6."""
        a = (14 - self.month)//12
        y = self.year - a
        m = self.month + 12*a -2
        d = (self.day + y + y//4 - y//100 + y//400 + (31*m//12))%7
        if d:
            ret = d - 1
        else:
            ret = 6
        return ret
Returns the weekday of the date.

        The format is as in the time module: Monday is 0 and sunday is 6.
recipes/Python/117215_A_Date_module/recipe-117215.py