fix parse date
This commit is contained in:
parent
0b9d6faaf6
commit
7f411e0b6a
1 changed files with 6 additions and 1 deletions
|
@ -372,12 +372,17 @@ def getMovieReleaseDate(imdbId):
|
|||
return first_release
|
||||
|
||||
def _parseDate(d):
|
||||
'''
|
||||
>>>_parseDate('3 March 1972')
|
||||
'1972-03-03'
|
||||
'''
|
||||
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:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
try:
|
||||
parsed_date = time.strptime(d, "%B %Y")
|
||||
parsed_date = '%s-%02d-01' % (parsed_date.tm_year, parsed_date.tm_mon)
|
||||
|
|
Loading…
Reference in a new issue