Commit eec09def authored by litaolemo's avatar litaolemo

update

parent 2a788ff8
......@@ -126,7 +126,7 @@ def trans_strtime_to_timestamp(input_time, missing_year=False):
print('error in {input_time}'.format(input_time=input_time))
return real_time
#for str_time %Y-%m
if len(input_time) == 5 :
if len(input_time) == 5:
year = func_inyear(input_time)
if year != str(0):
input_time = year + '-' + input_time
......@@ -135,6 +135,15 @@ def trans_strtime_to_timestamp(input_time, missing_year=False):
else:
print('error in {input_time}'.format(input_time=input_time))
return real_time
if len(input_time) == 11:
year = func_inyear(input_time)
if year != str(0):
input_time = year + '-'
real_time = int(datetime.datetime.strptime(input_time,
'%Y-%m-%d %H:%M').timestamp()*1e3)
else:
print('error in {input_time}'.format(input_time=input_time))
return real_time
try:
return int(datetime.datetime.strptime(input_time,'%Y-%m-%d %H:%M:%S').timestamp()*1e3)
except:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment