def parseDate(self, dateString, sourceTime=None):
if sourceTime is None:<EOL><INDENT>yr, mth, dy, hr, mn, sec, wd, yd, isdst = time.localtime()<EOL><DEDENT>else:<EOL><INDENT>yr, mth, dy, hr, mn, sec, wd, yd, isdst = sourceTime<EOL><DEDENT>v1 = -<NUM_LIT:1><EOL>v2 = -<NUM_LIT:1><EOL>v3 = -<NUM_LIT:1><EOL>accuracy = []<EOL>s = dateString<EOL>m = self.ptc.CRE_DATE2.search(s)<EOL>if m is not None:<EOL><INDENT>index = m.start()<EOL>v1 = int(s[:index])<EOL>s = s[index + <NUM_LIT:1>:]<EOL><DEDENT>m = self.ptc.CRE_DATE2.search(s)<EOL>if m is not None:<EOL><INDENT>index = m.start()<EOL>v2 = int(s[:index])<EOL>v3 = int(s[index + <NUM_LIT:1>:])<EOL><DEDENT>else:<EOL><INDENT>v2 = int(s.strip())<EOL><DEDENT>v = [v1, v2, v3]<EOL>d = {'<STR_LIT:m>': mth, '<STR_LIT:d>': dy, '<STR_LIT:y>': yr}<EOL>dp_order = self.ptc.dp_order if v1 <= <NUM_LIT> else ['<STR_LIT:y>', '<STR_LIT:m>', '<STR_LIT:d>']<EOL>for i in range(<NUM_LIT:0>, <NUM_LIT:3>):<EOL><INDENT>n = v[i]<EOL>c = dp_order[i]<EOL>if n >= <NUM_LIT:0>:<EOL><INDENT>d[c] = n<EOL>accuracy.append({'<STR_LIT:m>': pdtContext.ACU_MONTH,<EOL>'<STR_LIT:d>': pdtContext.ACU_DAY,<EOL>'<STR_LIT:y>': pdtContext.ACU_YEAR}[c])<EOL><DEDENT><DEDENT>if v3 == -<NUM_LIT:1> and ((mth > d['<STR_LIT:m>']) or (mth == d['<STR_LIT:m>'] and dy > d['<STR_LIT:d>'])):<EOL><INDENT>yr = d['<STR_LIT:y>'] + self.ptc.YearParseStyle<EOL><DEDENT>else:<EOL><INDENT>yr = d['<STR_LIT:y>']<EOL><DEDENT>mth = d['<STR_LIT:m>']<EOL>dy = d['<STR_LIT:d>']<EOL>if yr < self.ptc.BirthdayEpoch:<EOL><INDENT>yr += <NUM_LIT><EOL><DEDENT>elif yr < <NUM_LIT:100>:<EOL><INDENT>yr += <NUM_LIT><EOL><DEDENT>daysInCurrentMonth = self.ptc.daysInMonth(mth, yr)<EOL>debug and log.debug('<STR_LIT>',<EOL>yr, mth, dy, daysInCurrentMonth)<EOL>with self.context() as ctx:<EOL><INDENT>if mth > <NUM_LIT:0> and mth <= <NUM_LIT:12> and dy > <NUM_LIT:0> anddy <= daysInCurrentMonth:<EOL><INDENT>sourceTime = (yr, mth, dy, hr, mn, sec, wd, yd, isdst)<EOL>ctx.updateAccuracy(*accuracy)<EOL><DEDENT>else:<EOL><INDENT>sourceTime = time.localtime()<EOL><DEDENT><DEDENT>return sourceTime<EOL>
Parse short-form date strings::

    '05/28/2006' or '04.21'

@type  dateString: string
@param dateString: text to convert to a C{datetime}
@type  sourceTime:     struct_time
@param sourceTime:     C{struct_time} value to use as the base

@rtype:  struct_time
@return: calculated C{struct_time} value of dateString