forked from Galtzor/elaeps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalendar.py
More file actions
38 lines (35 loc) · 1.31 KB
/
Calendar.py
File metadata and controls
38 lines (35 loc) · 1.31 KB
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
31
32
33
34
35
36
37
38
import datetime
class Calendar():
def __init__(self):
self.date = datetime.date.today()
self.delta = datetime.timedelta(1) # Ein dag forskjell fra dag til dag.
def nextDay(self):
self.date = self.date + self.delta
def getDate(self):
return self.date
def toString(self):
#Day, Month day, year
return ("{:s}, {:s} {:d}, {:d}").format(self.weekDay(), self.month(), self.date.day, self.date.year)
def weekDay(self):
weekday = self.date.weekday()
if weekday == 0: return "Monday"
if weekday == 1: return "Tuesday"
if weekday == 2: return "Wednesday"
if weekday == 3: return "Thursday"
if weekday == 4: return "Friday"
if weekday == 5: return "Saturday"
if weekday == 6: return "Sunday"
def month(self):
month = self.date.month
if month == 1: return "January"
if month == 2: return "February"
if month == 3: return "March"
if month == 4: return "April"
if month == 5: return "May"
if month == 6: return "June"
if month == 7: return "July"
if month == 8: return "August"
if month == 9: return "September"
if month == 10: return "October"
if month == 11: return "November"
if month == 12: return "December"