Anonymous user
Discordian date: Difference between revisions
no edit summary
(Added missing </lang>) |
No edit summary |
||
Line 6:
=={{header|Python}}==
<lang python>import datetime, calendar
DISCORDIAN_SEASONS = ["Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"]
Line 12:
def ddate(year, month, day):
today = datetime.date(year, month, day)
is_leap_year =
if is_leap_year and month == 2 and day == 29:
▲ return "St. Tib's Day, YOLD " + (year + 1166)
▲ day_of_year = (today - datetime.date(year, 1, 1)).days
if is_leap_year and day_of_year >= 60:
day_of_year -= 1 # Compensate for St. Tib's Day
season, dday = divmod(day_of_year
</lang>
|