We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1393d06 commit 5df0eacCopy full SHA for 5df0eac
pendulum/date.py
@@ -123,11 +123,27 @@ def _setter(self, **kwargs):
123
124
@property
125
def day_of_week(self):
126
- return int(self.format('%w', formatter='classic'))
+ """
127
+ Returns the day of the week (0-6).
128
+
129
+ :rtype: int
130
131
+ return self.isoweekday() % 7
132
133
134
def day_of_year(self):
- return int(self.format('%j', formatter='classic'))
135
136
+ Returns the day of the year (1-366).
137
138
139
140
+ k = 1 if self.is_leap_year else 2
141
142
+ return (
143
+ (275 * self.month) // 9
144
+ - k * (self.month + 9) // 12
145
+ + self.day - 30
146
+ )
147
148
149
def week_of_year(self):
0 commit comments