This commit is contained in:
yumoqing 2024-10-25 12:06:27 +08:00
parent c0ebfc3ec5
commit 78df413d4e

View File

@ -5,6 +5,17 @@ from datetime import date, timedelta, datetime
leapMonthDays = [0,31,29,31,30,31,30,31,31,30,31,30,31] leapMonthDays = [0,31,29,31,30,31,30,31,31,30,31,30,31]
unleapMonthDays = [0,31,28,31,30,31,30,31,31,30,31,30,31] unleapMonthDays = [0,31,28,31,30,31,30,31,31,30,31,30,31]
def days_between(date_str1, date_str2):
# Convert the strings to datetime objects
date1 = datetime.strptime(date_str1, '%Y-%m-%d')
date2 = datetime.strptime(date_str2, '%Y-%m-%d')
# Calculate the difference between the two dates
delta = date2 - date1
# Get the number of days
days = abs(delta.days)
def curDatetime(): def curDatetime():
return datetime.now() return datetime.now()