Skip to content

Commit

Permalink
simplified timezone regex
Browse files Browse the repository at this point in the history
  • Loading branch information
santagada committed May 31, 2011
1 parent 93a430a commit a31619b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ofxparse/ofxparse.py
Expand Up @@ -147,10 +147,11 @@ def parse(cls_, file_handle):
def parseOfxDateTime(cls_, ofxDateTime):
#dateAsString looks something like 20101106160000.00[-5:EST]
#for 6 Nov 2010 4pm UTC-5 aka EST
res = re.match("^.*\[(?P<tz>-?\d{1,2})\:\w*\]", ofxDateTime)
tz = 0
res = re.search("\[(?P<tz>-?\d+)\:\w*\]$", ofxDateTime)
if res:
tz = int(res.group('tz'))
else:
tz = 0

timeZoneOffset = datetime.timedelta(hours=tz)

Expand Down

0 comments on commit a31619b

Please sign in to comment.