时间转换工具
时间转换工具
格式化时间转换成时间戳
def date_to_timestamp(date, format_string="%Y-%m-%d"):
time_array = time.strptime(date, format_string)
time_stamp = int(time.mktime(time_array))
return time_stamp
def date1_to_timestamp(date, format_string="%Y-%m-%d %H:%M:%S"):
time_array = time.strptime(date, format_string)
time_stamp = int(time.mktime(time_array))
return time_stamp