时间
作者:互联网
time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
today = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
def yield_day(start_day, stop_time=None): if isinstance(stop_time, str): stop_time = datetime.datetime.strptime(stop_time, '%Y-%m-%d').date() + datetime.timedelta(days=1) else: stop_time = datetime.date.today() start_time = datetime.datetime.strptime(start_day, '%Y-%m-%d').date() while True: yield start_time start_time = start_time + datetime.timedelta(days=1) if time.mktime(start_time.timetuple()) >= time.mktime(stop_time.timetuple()): break
time.strptime(time1, '%Y-%m-%d')
标签:-%,strptime,stop,datetime,start,时间,time 来源: https://www.cnblogs.com/ceason/p/16377525.html