Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #78 from takkii/develop
Browse files Browse the repository at this point in the history
Update.
  • Loading branch information
takkii authored Apr 3, 2024
2 parents ca69ed0 + fbf4fc9 commit ced1fef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions unit/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,28 @@ def main():
calc = (year + year / 4 - year / 100 + year / 400 +
(13 * month + 8) / 5 + day) % 7

st_week = str(datetime.datetime.now().weekday())

if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
st_calc = int(st_week) + 1
else:
st_calc = int(st_week)

week = ["Sun", "Mon", "Tues", "Wedness", "Thurs", "Fri", "Satur"]
cl_wk = week[round(calc)]

st_wk = week[int(st_calc)]
week_bl = bool(cl_wk == st_wk)

print(st_year + "/" + st_month + "/" + st_day + " : " + cl_wk + "day")

if week_bl is True:
print("Weekday is correct, OK!")
elif week_bl is False:
print("Else is False, NO!")
else:
raise RuntimeError from None

# Custom Exception.
except ValueError as ext:
print(ext)
Expand Down

0 comments on commit ced1fef

Please sign in to comment.