|
@@ -9,15 +9,15 @@ class ReportPublicFunsUtils:
|
|
:param type 1 :y m d 2: y m d : s m m
|
|
:param type 1 :y m d 2: y m d : s m m
|
|
:return:
|
|
:return:
|
|
"""
|
|
"""
|
|
- now_time = datetime.datetime.now()
|
|
|
|
- year = now_time.year
|
|
|
|
- month = now_time.month
|
|
|
|
|
|
+ pre_day = ReportPublicFunsUtils.before_day()
|
|
|
|
+ year = pre_day.year
|
|
|
|
+ month = pre_day.month
|
|
month = str(month) if month > 9 else '0' + str(month)
|
|
month = str(month) if month > 9 else '0' + str(month)
|
|
first_day_of_month = str(year) + '-' + month
|
|
first_day_of_month = str(year) + '-' + month
|
|
if type:
|
|
if type:
|
|
- return [first_day_of_month + '-01 00:00:00', ReportPublicFunsUtils.before_day().strftime('%Y-%m-%d %M:%I:%S')]
|
|
|
|
|
|
+ return [first_day_of_month + '-01 00:00:00', pre_day.strftime('%Y-%m-%d %M:%I:%S')]
|
|
else:
|
|
else:
|
|
- return [first_day_of_month + '-01', ReportPublicFunsUtils.before_day().strftime('%Y-%m-%d')]
|
|
|
|
|
|
+ return [first_day_of_month + '-01', pre_day.strftime('%Y-%m-%d')]
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def before_day():
|
|
def before_day():
|
|
@@ -40,16 +40,16 @@ class ReportPublicFunsUtils:
|
|
return ['2020-02-18', ReportPublicFunsUtils.before_day().strftime('%Y-%m-%d')]
|
|
return ['2020-02-18', ReportPublicFunsUtils.before_day().strftime('%Y-%m-%d')]
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
- def get_montho_day():
|
|
|
|
- now = datetime.datetime.now()
|
|
|
|
- month = now.month
|
|
|
|
- day = now.day - 1
|
|
|
|
|
|
+ def get_month_day():
|
|
|
|
+ pre_time = ReportPublicFunsUtils.before_day()
|
|
|
|
+ month = pre_time.month
|
|
|
|
+ day = pre_time.day
|
|
return '{}月{}日'.format(month, day)
|
|
return '{}月{}日'.format(month, day)
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def get_month():
|
|
def get_month():
|
|
- now = datetime.datetime.now()
|
|
|
|
- return str(now.month)
|
|
|
|
|
|
+ pre_time = ReportPublicFunsUtils.before_day()
|
|
|
|
+ return str(pre_time.month)
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def get_pre_day():
|
|
def get_pre_day():
|
|
@@ -74,4 +74,4 @@ class ReportPublicFunsUtils:
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
- print(ReportPublicFunsUtils.get_prd_day())
|
|
|
|
|
|
+ print(ReportPublicFunsUtils.get_time_range_month())
|