def date_from_relative_day(base_date, time, dow):
 base_date = datetime(base_date.year, base_date.month, base_date.day)
 time = time.lower()
 dow = dow.lower()
 if ((time == 'this') or (time == 'coming')):
  num = HASHWEEKDAYS[dow]
  return this_week_day(base_date, num)
 elif ((time == 'last') or (time == 'previous')):
  num = HASHWEEKDAYS[dow]
  return previous_week_day(base_date, num)
 elif ((time == 'next') or (time == 'following')):
  num = HASHWEEKDAYS[dow]
  return next_week_day(base_date, num)

def date_from_relative_day ( base_date , time , dow ) : base_date = datetime ( base_date . year , base_date . month , base_date . day ) time = time . lower ( ) dow = dow . lower ( ) if ( ( time == 'this' ) or ( time == 'coming' ) ) : num = HASHWEEKDAYS [ dow ] return this_week_day ( base_date , num ) elif ( ( time == 'last' ) or ( time == 'previous' ) ) : num = HASHWEEKDAYS [ dow ] return previous_week_day ( base_date , num ) elif ( ( time == 'next' ) or ( time == 'following' ) ) : num = HASHWEEKDAYS [ dow ] return next_week_day ( base_date , num )
converts relative day to time ex: this tuesday .