Show More
@@ -1371,11 +1371,8 def shortdate(date=None): | |||
|
1371 | 1371 | """turn (timestamp, tzoff) tuple into iso 8631 date.""" |
|
1372 | 1372 | return datestr(date, format='%Y-%m-%d') |
|
1373 | 1373 | |
|
1374 | def strdate(string, format, defaults=[]): | |
|
1375 |
"""parse a |
|
|
1376 | if the string cannot be parsed, ValueError is raised.""" | |
|
1377 | def timezone(string): | |
|
1378 | tz = string.split()[-1] | |
|
1374 | def parsetimezone(tz): | |
|
1375 | """parse a timezone string and return an offset integer""" | |
|
1379 | 1376 |
|
|
1380 | 1377 |
|
|
1381 | 1378 |
|
@@ -1385,8 +1382,11 def strdate(string, format, defaults=[]) | |||
|
1385 | 1382 |
|
|
1386 | 1383 |
|
|
1387 | 1384 | |
|
1385 | def strdate(string, format, defaults=[]): | |
|
1386 | """parse a localized time string and return a (unixtime, offset) tuple. | |
|
1387 | if the string cannot be parsed, ValueError is raised.""" | |
|
1388 | 1388 | # NOTE: unixtime = localunixtime + offset |
|
1389 | offset, date = timezone(string), string | |
|
1389 | offset, date = parsetimezone(string.split()[-1]), string | |
|
1390 | 1390 | if offset is not None: |
|
1391 | 1391 | date = " ".join(string.split()[:-1]) |
|
1392 | 1392 |
General Comments 0
You need to be logged in to leave comments.
Login now