赞
踩
# -*- coding: utf-8 -*- """ Created on Fri Aug 16 2019 @author: YangYang """ import easygui as g import datetime # 获取今天的日期 today = datetime.date.today() # 判断日期是否合法 def is_date(date): try: datetime.datetime.strptime(date,"%Y-%m-%d") return True except: return False #计算两个日期相差天数 def Caltime(): msg = "请输入需要计算的日期" title = "计算两个日期的差" fieldNames = ["日期1", "日期2"] fieldValues = [today,today] fieldValues = g.multenterbox(msg,title, fieldNames,values = fieldValues) while True: date1 = fieldValues[0] date2 = fieldValues[1] if is_date(date1) and is_date(date2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。