#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
import tools
import time
import calendar
import datetime

cal = calendar.month(2016, 1)
print ("以下输出2016年1月份的日历:")
print (cal)

localtime = time.localtime(time.time())
print ("本地时间为 :", localtime)
localtime = time.asctime(localtime )
print ("本地时间为 :", localtime)
# 格式化成2016-03-20 11:45:39形式
print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
a = "2020-01-13 15:19:48"
print (time.mktime(time.strptime(a,"%Y-%m-%d %H:%M:%S")))
# 格式化成Sat Mar 28 22:24:24 2016形式
print (time.strftime("%a %b %d %H:%M:%S %Y", time.localtime()))
  
# 将格式字符串转换为时间戳
a = "Sat Mar 28 22:24:24 2016"
print (time.mktime(time.strptime(a,"%a %b %d %H:%M:%S %Y")))

print(time.strftime("%Y-%m-%d", time.localtime()))

now = datetime.datetime.now()
date = now + datetime.timedelta(days = 1)
print(datetime.timedelta(days = 1))

print(now.strftime('%Y-%m-%d'), ' ~ ', date.strftime('%Y-%m-%d')) 
