字符串日期格式化为秒数,返回浮点类型【每日一个知识点第348期-Python】
字符串日期格式化为秒数,返回浮点类型:
expire_time = "2013-05-21 09:50:35" d = datetime.datetime.strptime(expire_time,"%Y-%m-%d %H:%M:%S") time_sec_float = time.mktime(d.timetuple()) print time_sec_float
字符串日期格式化为秒数,返回浮点类型:
expire_time = "2013-05-21 09:50:35" d = datetime.datetime.strptime(expire_time,"%Y-%m-%d %H:%M:%S") time_sec_float = time.mktime(d.timetuple()) print time_sec_float