-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweekend.py
30 lines (22 loc) · 1.1 KB
/
weekend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import datetime
# now = datetime.datetime.now()
now = datetime.datetime.now() + datetime.timedelta(days=7)
two_days_from_now = now + datetime.timedelta(days=2)
day_of_the_week = now.strftime("%A")
# Calculate business days
if day_of_the_week == "Monday" or day_of_the_week == "Tuesday" or day_of_the_week == "Wednesday":
two_business_day_from_now = now + datetime.timedelta(days=2)
if day_of_the_week == "Thursday":
two_business_day_from_now = now + datetime.timedelta(days=4)
if day_of_the_week == "Friday":
two_business_day_from_now = now + datetime.timedelta(days=5)
if day_of_the_week == "Saturday":
two_business_day_from_now = now + datetime.timedelta(days=4)
if day_of_the_week == "Sunday":
two_business_day_from_now = now + datetime.timedelta(days=3)
#print "Today: " + str(now)
print "Today: " + now.strftime("%A, %B %e, %Y %r")
#print "Two days from now: " + str(two_days_from_now)
print "Two days from now: " + two_days_from_now.strftime("%A, %B %e, %Y %r")
print "Two business days from now: " + two_business_day_from_now.strftime("%A, %B %e, %Y %r")
print "Day code: " + now.strftime("%w")