Difference between revisions of "Using Python dateutil to get Large Date Offsets"

From PeformIQ Upgrade
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:


My program reads six digit dates, *yymmdd*, as *19yymmdd*.  I adjust the *19yymmdd* dates to <b>20yymmdd</b> as follows:
My program reads six digit dates, <b>yymmdd</b>, as <b>19yymmdd</b>.  I adjust these <b>19yymmdd</b> dates to <b>20yymmdd</b> as follows:


<pre>
<pre>

Latest revision as of 14:02, 12 January 2014

My program reads six digit dates, yymmdd, as 19yymmdd. I adjust these 19yymmdd dates to 20yymmdd as follows:

        self.DoB = datetime.strptime(line[27:35], "%Y%m%d")

        if self.DoB < datetime(2000, 01, 01):
            self.DoB += relativedelta(years=100)