def _date_from_string(year, year_format, month='', month_format='', day='', day_format='', delim='__'):
 format = delim.join((year_format, month_format, day_format))
 datestr = delim.join((year, month, day))
 try:
  return datetime.datetime.strptime(datestr, format).date()
 except ValueError:
  raise Http404((_("Invalid date string '%(datestr)s' given format '%(format)s'") % {'datestr': datestr, 'format': format}))

def _date_from_string ( year , year_format , month = '' , month_format = '' , day = '' , day_format = '' , delim = '__' ) : format = delim . join ( ( year_format , month_format , day_format ) ) datestr = delim . join ( ( year , month , day ) ) try : return datetime . datetime . strptime ( datestr , format ) . date ( ) except ValueError : raise Http404 ( ( _ ( "Invalid date string '%(datestr)s' given format '%(format)s'" ) % { 'datestr' : datestr , 'format' : format } ) )
helper: get a datetime .