import datetime import time from datetime import timezone, timedelta, datetime import boto3 from AnsjerPush.config import AWS_SES_ACCESS_ID, AWS_SES_ACCESS_SECRET # client = boto3.client('cloudwatch', region_name='us-east-1', aws_access_key_id=AWS_SES_ACCESS_ID, aws_secret_access_key=AWS_SES_ACCESS_SECRET) # response = client.get_dashboard(DashboardName='string') # print(response) # localtime = time.localtime(1601482210) # current_month = localtime.tm_mon # print(current_month) # # time_struct = [localtime.tm_year, localtime.tm_mon, 1, 0, 0, 0, 0, 0, 0] # start_time = int(time.mktime(tuple(time_struct))) # print(start_time) # # time_struct[1] = current_month + 1 # end_time = int(time.mktime(tuple(time_struct))) # print(end_time) # current_time = int(1601565010 - 8 * 3600) # print(current_time) # count = int(current_time / (24 * 3600)) # current_time = count * 24 * 3600 # print(current_time) # localtime = time.localtime(1601565010) # datetime.datetime() # current_day = localtime.tm_mday # # time_struct = [localtime.tm_year, localtime.tm_mon, current_day, 0, 0, 0, 0, 0, 0] # current_time = int(time.mktime(tuple(time_struct))) # print(current_time) # gmtime = time.gmtime(1601568621 + 28800) # current_day = gmtime.tm_mday # print(current_day) # print(gmtime.tm_hour) # time_struct = [gmtime.tm_year, gmtime.tm_mon, current_day, 0, 0, 0, 0, 0, 0] # current_time = int(time.mktime(tuple(time_struct))) # print(current_time - 28800) gmtime = time.gmtime(int(time.time()) + 28800) current_month = gmtime.tm_mon - 1 print(current_month) time_struct = [gmtime.tm_year, current_month, 1, 0, 0, 0, 0, 0, gmtime.tm_isdst] start_time = int(time.mktime(tuple(time_struct))) - 28800 print(start_time) time_struct[1] = current_month + 1 end_time = int(time.mktime(tuple(time_struct))) - 28800 print(end_time)