|
@@ -33,6 +33,8 @@ from dateutil.relativedelta import relativedelta
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
def getDateLists(begin, end):
|
|
|
"""
|
|
|
返回一个时间列表
|
|
@@ -399,8 +401,22 @@ def stamp_to_str(stamp):
|
|
|
return time.strftime("%Y-%m-%d %H:%M:%S", a)
|
|
|
|
|
|
|
|
|
+def getTodayOrYestoday():
|
|
|
+ """
|
|
|
+ 如果当天零点 则返回昨天
|
|
|
+ 否则返回今天
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ if datetime.datetime.today().hour == 0:
|
|
|
+ return get_n_day(-1,is_timestamp=1)
|
|
|
+ else:
|
|
|
+ return get_n_day(0,is_timestamp=1)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
+
|
|
|
+ print(getTodayOrYestoday())
|
|
|
|
|
|
|
|
|
- print(stamp_to_str(get_n_day(is_timestamp=1)))
|
|
|
+
|