def _get_yesterdays_date():
current = date.today()
current_time = datetime.utcnow()
if current.day == 1:
if current_time.hour <= 5:
return date(current.year, current.month-1, (calendar.monthrange(current.year, current.month-1)[2])).strftime('%Y-%m-%d')
else:
return date(current.year, current.month-1, (calendar.monthrange(current.year, current.month-1)[1])).strftime('%Y-%m-%d')
else:
if current_time.hour <= 5:
return date(current.year, current.month, current.day-2).strftime('%Y-%m-%d')
else:
return date(current.year, current.month, current.day-1).strftime('%Y-%m-%d')
评论列表
文章目录