diff --git a/appPublic/timeUtils.py b/appPublic/timeUtils.py index c4e76fe..388a094 100755 --- a/appPublic/timeUtils.py +++ b/appPublic/timeUtils.py @@ -5,6 +5,17 @@ from datetime import date, timedelta, datetime 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] +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(): return datetime.now()