def add_to_date(date, years=0, months=0, days=0, hours=0, as_string=False, as_datetime=False):
 from dateutil.relativedelta import relativedelta
 if (date == None):
  date = now_datetime()
 if hours:
  as_datetime = True
 if isinstance(date, basestring):
  as_string = True
  if (u' ' in date):
   as_datetime = True
  date = parser.parse(date)
 date = (date + relativedelta(years=years, months=months, days=days, hours=hours))
 if as_string:
  if as_datetime:
   return date.strftime(DATETIME_FORMAT)
  else:
   return date.strftime(DATE_FORMAT)
 else:
  return date

def add_to_date ( date , years = 0 , months = 0 , days = 0 , hours = 0 , as_string = False , as_datetime = False ) : from dateutil . relativedelta import relativedelta if ( date == None ) : date = now_datetime ( ) if hours : as_datetime = True if isinstance ( date , basestring ) : as_string = True if ( u' ' in date ) : as_datetime = True date = parser . parse ( date ) date = ( date + relativedelta ( years = years , months = months , days = days , hours = hours ) ) if as_string : if as_datetime : return date . strftime ( DATETIME_FORMAT ) else : return date . strftime ( DATE_FORMAT ) else : return date
adds days to the given date .