把時間戳,去掉日時分秒,保留年月,方便判斷是否是本月
def get_month_timestamp(timestamp):
#時間戳轉爲元組
now = time.localtime(timestamp)
#元組轉爲字符串
monthStr = time.strftime("%Y-%m-00 00:00:00", now)
#字符串轉爲元組
monthTuple = time.strptime(monthStr, '%Y-%m-00 00:00:00')
#元組轉爲時間戳
return time.mktime(monthTuple)