okay, just a lame bit of code to let me know how long before I can quit
This commit is contained in:
29
countdown.py
Executable file
29
countdown.py
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def count_business_days(start_date, end_date):
|
||||
business_days = 0
|
||||
current_date = start_date
|
||||
|
||||
while current_date <= end_date:
|
||||
# Check if the current day is a weekday (Mon-Fri)
|
||||
if current_date.weekday() < 5: # 0 = Monday, 4 = Friday
|
||||
business_days += 1
|
||||
current_date += timedelta(days=1)
|
||||
|
||||
return business_days
|
||||
|
||||
# Get the current date and the target date
|
||||
now = datetime.now()
|
||||
target_date = datetime(now.year, 4, 8)
|
||||
|
||||
# Adjust the target year if April 8 is in the next year
|
||||
if now > target_date:
|
||||
target_date = target_date.replace(year=now.year + 1)
|
||||
|
||||
# Calculate the number of business days remaining
|
||||
remaining_business_days = count_business_days(now, target_date)
|
||||
|
||||
print(f"Business days remaining until April 8: {remaining_business_days}")
|
||||
|
||||
Reference in New Issue
Block a user