dont use strftime, it does not work for years like 1897
This commit is contained in:
parent
e29e2cc06b
commit
0b9d6faaf6
1 changed files with 3 additions and 2 deletions
|
@ -374,18 +374,19 @@ def getMovieReleaseDate(imdbId):
|
|||
def _parseDate(d):
|
||||
try:
|
||||
parsed_date = time.strptime(d, "%d %B %Y")
|
||||
parsed_date = '%s-%02d-%02d' % (parsed_date.tm_year, parsed_date.tm_mon, parsed_date.tm_mday)
|
||||
parsed_date = time.strftime('%Y-%m-%d', parsed_date)
|
||||
return parsed_date
|
||||
except:
|
||||
try:
|
||||
parsed_date = time.strptime(d, "%B %Y")
|
||||
parsed_date = time.strftime('%Y-%m-01', parsed_date)
|
||||
parsed_date = '%s-%02d-01' % (parsed_date.tm_year, parsed_date.tm_mon)
|
||||
return parsed_date
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
parsed_date = time.strptime(d, "%Y")
|
||||
parsed_date = time.strftime('%Y-01-01', parsed_date)
|
||||
parsed_date = '%s-01-01' % (parsed_date.tm_year)
|
||||
return parsed_date
|
||||
except:
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue