转 https://www.cnblogs.com/sunshineyang/p/6818834.html
end = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
end_date = datetime.today().strptime(end, '%Y-%m-%d %H:%M:%S')
begin_date = end_date + timedelta(days=-1)
end_date = datetime.today()
begin_date = end_date + timedelta(days=-1)