Commit eec09def authored by litaolemo's avatar litaolemo

update

parent 2a788ff8
......@@ -126,15 +126,24 @@ 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
real_time = int(datetime.datetime.strptime(input_time,
real_time = int(datetime.datetime.strptime(input_time,
'%Y-%m-%d').timestamp()*1e3)
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