MCPcopy
hub / github.com/django/django / DateFormat

Class DateFormat

django/utils/dateformat.py:198–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197
198class DateFormat(TimeFormat):
199 def b(self):
200 "Month, textual, 3 letters, lowercase; e.g. 'jan'"
201 return MONTHS_3[self.data.month]
202
203 def c(self):
204 """
205 ISO 8601 Format
206 Example : '2008-01-02T10:30:00.000123'
207 """
208 return self.data.isoformat()
209
210 def d(self):
211 "Day of the month, 2 digits with leading zeros; i.e. '01' to '31'"
212 return "%02d" % self.data.day
213
214 def D(self):
215 "Day of the week, textual, 3 letters; e.g. 'Fri'"
216 return WEEKDAYS_ABBR[self.data.weekday()]
217
218 def E(self):
219 """
220 Alternative month names as required by some locales. Proprietary
221 extension.
222 """
223 return MONTHS_ALT[self.data.month]
224
225 def F(self):
226 "Month, textual, long; e.g. 'January'"
227 return MONTHS[self.data.month]
228
229 def I(self): # NOQA: E743, E741
230 "'1' if daylight saving time, '0' otherwise."
231 if self.timezone is None:
232 return ""
233 return "1" if self.timezone.dst(self.data) else "0"
234
235 def j(self):
236 "Day of the month without leading zeros; i.e. '1' to '31'"
237 return self.data.day
238
239 def l(self): # NOQA: E743, E741
240 "Day of the week, textual, long; e.g. 'Friday'"
241 return WEEKDAYS[self.data.weekday()]
242
243 def L(self):
244 "Boolean for whether it is a leap year; i.e. True or False"
245 return calendar.isleap(self.data.year)
246
247 def m(self):
248 "Month; i.e. '01' to '12'"
249 return "%02d" % self.data.month
250
251 def M(self):
252 "Month, textual, 3 letters; e.g. 'Jan'"
253 return MONTHS_3[self.data.month].title()
254
255 def n(self):

Callers 1

formatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected