(year, month, count)
return res.date()
For a given month get the Nth day.
    The only reason this function exists in favor of
    just creating the date object is to support negative numbers
    e.g. pass in -1 for "last"
For a given month get the Nth day.
    The only reason this function exists in favor of
    just creating the date object is to support negative numbers
    e.g. pass in -1 for "last"
For a given month get the Nth day . The only reason this function exists in favor of just creating the date object is to support negative numbers e . g . pass in - 1 for last
def get_day_of_month(year, month, count):
    """
    For a given month get the Nth day.
    The only reason this function exists in favor of
    just creating the date object is to support negative numbers
    e.g. pass in -1 for "last"
    """
    r = rrule.rrule(
        rrule.MONTHLY, dtstart=datetime.datetime(year, month, 1),
        byweekday=(rrule.MO, rrule.TU, rrule.WE, rrule.TH, rrule.FR, rrule.SA, rrule.SU),
        bysetpos=count)
    res = r[0]
    if (res is None or res.month != month or res.year != year):
        raise ValueError("No dates found in range. is there a flaw in your logic?")
    return res.date()
def get_day_of_month ( year , month , count ) : r = rrule . rrule ( rrule . MONTHLY , dtstart = datetime . datetime ( year , month , 1 ) , byweekday = ( rrule . MO , rrule . TU , rrule . WE , rrule . TH , rrule . FR , rrule . SA , rrule . SU ) , bysetpos = count ) res = r [ 0 ] if ( res is None or res . month != month or res . year != year ) : raise ValueError ( "No dates found in range. is there a flaw in your logic?" ) return res . date ( )