Created
March 1, 2016 10:00
-
-
Save XaviTorello/2491c7b4e7a6f82c2118 to your computer and use it in GitHub Desktop.
Electrical Calendar example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from electrical_calendar.electrical_calendar import REECalendar | |
from datetime import datetime | |
#logging.basicConfig(level=logging.DEBUG) | |
ree_cal = REECalendar() | |
# Get all holidays for 2016 | |
print ree_cal.holidays(2016) | |
# Get all holidays for 2017 | |
print ree_cal.holidays(2017) | |
# Review if 2016/5/1 is a holiday | |
day=datetime(2016,5,1) | |
ree_cal.is_holiday(day) | |
# Return True | |
# Review if 2016/3/1 is a holiday | |
day=datetime(2016,3,1) | |
ree_cal.is_holiday(day) | |
# Return False | |
# Review if 2016/3/1 (tuesday) is workable (if it's a weekday) | |
ree_cal.is_worable(day) | |
# Return True | |
# Review if 2016/2/27 (sunday) is workable (if it's a weekday) | |
day=datetime(2016,2,27) | |
ree_cal.is_worable(day) | |
# Return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment