|
@@ -152,6 +152,7 @@ def get_today_date(timestamp=False):
|
|
|
return zero_today, last_today
|
|
|
return zero_today, last_today
|
|
|
|
|
|
+
|
|
|
def get_last_week():
|
|
|
"""
|
|
|
获取前一周时间
|
|
@@ -162,6 +163,7 @@ def get_last_week():
|
|
|
last_week_date = last_week.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
return last_week_date
|
|
|
|
|
|
+
|
|
|
def get_last_month():
|
|
|
"""
|
|
|
获取前一个月时间
|
|
@@ -243,6 +245,17 @@ def get_start_and_end_time(date, str_format):
|
|
|
return 0
|
|
|
|
|
|
|
|
|
+def time_stamp_to_time(time_stamp, time_format):
|
|
|
+ """
|
|
|
+ 时间戳转时间
|
|
|
+ @param time_stamp: 时间戳
|
|
|
+ @param time_format: 时间格式 例%Y-%m-%d %H:%M:%S
|
|
|
+ @return: 格式化后时间字符串
|
|
|
+ """
|
|
|
+ time_array = time.localtime(time_stamp)
|
|
|
+ return time.strftime(time_format, time_array)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
zero_today, last_today = get_today_date(True)
|
|
|
month_end = get_cur_month_end()
|
|
@@ -250,7 +263,6 @@ if __name__ == '__main__':
|
|
|
print(zero_today)
|
|
|
print(month_end_time)
|
|
|
|
|
|
-
|
|
|
# # 获取当前月
|
|
|
# print('当前月', get_cur_month())
|
|
|
# # 获取上一个月
|