Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | :mod:`calendar` --- General calendar-related functions |
| 2 | ====================================================== |
| 3 | |
| 4 | .. module:: calendar |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 5 | :synopsis: Functions for working with calendars, including some emulation |
| 6 | of the Unix cal program. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 7 | .. sectionauthor:: Drew Csillag <drew_csillag@geocities.com> |
| 8 | |
| 9 | |
| 10 | This module allows you to output calendars like the Unix :program:`cal` program, |
| 11 | and provides additional useful functions related to the calendar. By default, |
| 12 | these calendars have Monday as the first day of the week, and Sunday as the last |
| 13 | (the European convention). Use :func:`setfirstweekday` to set the first day of |
| 14 | the week to Sunday (6) or to any other weekday. Parameters that specify dates |
| 15 | are given as integers. For related |
| 16 | functionality, see also the :mod:`datetime` and :mod:`time` modules. |
| 17 | |
Benjamin Peterson | d7c3ed5 | 2010-06-27 22:32:30 +0000 | [diff] [blame] | 18 | Most of these functions and classes rely on the :mod:`datetime` module which |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 19 | uses an idealized calendar, the current Gregorian calendar indefinitely extended |
| 20 | in both directions. This matches the definition of the "proleptic Gregorian" |
| 21 | calendar in Dershowitz and Reingold's book "Calendrical Calculations", where |
| 22 | it's the base calendar for all computations. |
| 23 | |
| 24 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 25 | .. class:: Calendar(firstweekday=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 26 | |
| 27 | Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the |
| 28 | first day of the week. ``0`` is Monday (the default), ``6`` is Sunday. |
| 29 | |
| 30 | A :class:`Calendar` object provides several methods that can be used for |
| 31 | preparing the calendar data for formatting. This class doesn't do any formatting |
| 32 | itself. This is the job of subclasses. |
| 33 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 34 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 35 | :class:`Calendar` instances have the following methods: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 36 | |
Alexandre Vassalotti | bee3253 | 2008-05-16 18:15:12 +0000 | [diff] [blame] | 37 | .. method:: iterweekdays() |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 38 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 39 | Return an iterator for the week day numbers that will be used for one |
| 40 | week. The first value from the iterator will be the same as the value of |
| 41 | the :attr:`firstweekday` property. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 42 | |
| 43 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 44 | .. method:: itermonthdates(year, month) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 45 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 46 | Return an iterator for the month *month* (1-12) in the year *year*. This |
| 47 | iterator will return all days (as :class:`datetime.date` objects) for the |
| 48 | month and all days before the start of the month or after the end of the |
| 49 | month that are required to get a complete week. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 50 | |
| 51 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 52 | .. method:: itermonthdays2(year, month) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 53 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 54 | Return an iterator for the month *month* in the year *year* similar to |
| 55 | :meth:`itermonthdates`. Days returned will be tuples consisting of a day |
| 56 | number and a week day number. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 57 | |
| 58 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 59 | .. method:: itermonthdays(year, month) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 60 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 61 | Return an iterator for the month *month* in the year *year* similar to |
| 62 | :meth:`itermonthdates`. Days returned will simply be day numbers. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 63 | |
| 64 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 65 | .. method:: monthdatescalendar(year, month) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 66 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 67 | Return a list of the weeks in the month *month* of the *year* as full |
| 68 | weeks. Weeks are lists of seven :class:`datetime.date` objects. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 69 | |
| 70 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 71 | .. method:: monthdays2calendar(year, month) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 72 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 73 | Return a list of the weeks in the month *month* of the *year* as full |
| 74 | weeks. Weeks are lists of seven tuples of day numbers and weekday |
| 75 | numbers. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 76 | |
| 77 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 78 | .. method:: monthdayscalendar(year, month) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 79 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 80 | Return a list of the weeks in the month *month* of the *year* as full |
| 81 | weeks. Weeks are lists of seven day numbers. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 82 | |
| 83 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 84 | .. method:: yeardatescalendar(year, width=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 85 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 86 | Return the data for the specified year ready for formatting. The return |
| 87 | value is a list of month rows. Each month row contains up to *width* |
| 88 | months (defaulting to 3). Each month contains between 4 and 6 weeks and |
| 89 | each week contains 1--7 days. Days are :class:`datetime.date` objects. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 90 | |
| 91 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 92 | .. method:: yeardays2calendar(year, width=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 93 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 94 | Return the data for the specified year ready for formatting (similar to |
| 95 | :meth:`yeardatescalendar`). Entries in the week lists are tuples of day |
| 96 | numbers and weekday numbers. Day numbers outside this month are zero. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 97 | |
| 98 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 99 | .. method:: yeardayscalendar(year, width=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 100 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 101 | Return the data for the specified year ready for formatting (similar to |
| 102 | :meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day |
| 103 | numbers outside this month are zero. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 104 | |
| 105 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 106 | .. class:: TextCalendar(firstweekday=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 107 | |
| 108 | This class can be used to generate plain text calendars. |
| 109 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 110 | :class:`TextCalendar` instances have the following methods: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 111 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 112 | .. method:: formatmonth(theyear, themonth, w=0, l=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 113 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 114 | Return a month's calendar in a multi-line string. If *w* is provided, it |
| 115 | specifies the width of the date columns, which are centered. If *l* is |
| 116 | given, it specifies the number of lines that each week will use. Depends |
| 117 | on the first weekday as specified in the constructor or set by the |
| 118 | :meth:`setfirstweekday` method. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 119 | |
| 120 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 121 | .. method:: prmonth(theyear, themonth, w=0, l=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 122 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 123 | Print a month's calendar as returned by :meth:`formatmonth`. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 124 | |
| 125 | |
Benjamin Peterson | 2021100 | 2009-11-25 18:34:42 +0000 | [diff] [blame] | 126 | .. method:: formatyear(theyear, w=2, l=1, c=6, m=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 127 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 128 | Return a *m*-column calendar for an entire year as a multi-line string. |
| 129 | Optional parameters *w*, *l*, and *c* are for date column width, lines per |
| 130 | week, and number of spaces between month columns, respectively. Depends on |
| 131 | the first weekday as specified in the constructor or set by the |
| 132 | :meth:`setfirstweekday` method. The earliest year for which a calendar |
| 133 | can be generated is platform-dependent. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 134 | |
| 135 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 136 | .. method:: pryear(theyear, w=2, l=1, c=6, m=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 137 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 138 | Print the calendar for an entire year as returned by :meth:`formatyear`. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 139 | |
| 140 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 141 | .. class:: HTMLCalendar(firstweekday=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 142 | |
| 143 | This class can be used to generate HTML calendars. |
| 144 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 145 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 146 | :class:`HTMLCalendar` instances have the following methods: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 147 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 148 | .. method:: formatmonth(theyear, themonth, withyear=True) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 149 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 150 | Return a month's calendar as an HTML table. If *withyear* is true the year |
| 151 | will be included in the header, otherwise just the month name will be |
| 152 | used. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 153 | |
| 154 | |
Benjamin Peterson | 2021100 | 2009-11-25 18:34:42 +0000 | [diff] [blame] | 155 | .. method:: formatyear(theyear, width=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 156 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 157 | Return a year's calendar as an HTML table. *width* (defaulting to 3) |
| 158 | specifies the number of months per row. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 159 | |
| 160 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 161 | .. method:: formatyearpage(theyear, width=3, css='calendar.css', encoding=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 162 | |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 163 | Return a year's calendar as a complete HTML page. *width* (defaulting to |
| 164 | 3) specifies the number of months per row. *css* is the name for the |
| 165 | cascading style sheet to be used. :const:`None` can be passed if no style |
| 166 | sheet should be used. *encoding* specifies the encoding to be used for the |
| 167 | output (defaulting to the system default encoding). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 168 | |
| 169 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 170 | .. class:: LocaleTextCalendar(firstweekday=0, locale=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 171 | |
| 172 | This subclass of :class:`TextCalendar` can be passed a locale name in the |
Georg Brandl | 7004bd1 | 2010-10-19 18:54:25 +0000 | [diff] [blame] | 173 | constructor and will return month and weekday names in the specified locale. |
| 174 | If this locale includes an encoding all strings containing month and weekday |
| 175 | names will be returned as unicode. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 176 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 177 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 178 | .. class:: LocaleHTMLCalendar(firstweekday=0, locale=None) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 179 | |
| 180 | This subclass of :class:`HTMLCalendar` can be passed a locale name in the |
Benjamin Peterson | e41251e | 2008-04-25 01:59:09 +0000 | [diff] [blame] | 181 | constructor and will return month and weekday names in the specified |
| 182 | locale. If this locale includes an encoding all strings containing month and |
| 183 | weekday names will be returned as unicode. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 184 | |
Georg Brandl | 7004bd1 | 2010-10-19 18:54:25 +0000 | [diff] [blame] | 185 | .. note:: |
| 186 | |
| 187 | The :meth:`formatweekday` and :meth:`formatmonthname` methods of these two |
| 188 | classes temporarily change the current locale to the given *locale*. Because |
| 189 | the current locale is a process-wide setting, they are not thread-safe. |
| 190 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 191 | |
| 192 | For simple text calendars this module provides the following functions. |
| 193 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 194 | .. function:: setfirstweekday(weekday) |
| 195 | |
| 196 | Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The |
| 197 | values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, |
| 198 | :const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are provided for |
| 199 | convenience. For example, to set the first weekday to Sunday:: |
| 200 | |
| 201 | import calendar |
| 202 | calendar.setfirstweekday(calendar.SUNDAY) |
| 203 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 204 | |
| 205 | .. function:: firstweekday() |
| 206 | |
| 207 | Returns the current setting for the weekday to start each week. |
| 208 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 209 | |
| 210 | .. function:: isleap(year) |
| 211 | |
| 212 | Returns :const:`True` if *year* is a leap year, otherwise :const:`False`. |
| 213 | |
| 214 | |
| 215 | .. function:: leapdays(y1, y2) |
| 216 | |
| 217 | Returns the number of leap years in the range from *y1* to *y2* (exclusive), |
| 218 | where *y1* and *y2* are years. |
| 219 | |
Georg Brandl | 55ac8f0 | 2007-09-01 13:51:09 +0000 | [diff] [blame] | 220 | This function works for ranges spanning a century change. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 221 | |
| 222 | |
| 223 | .. function:: weekday(year, month, day) |
| 224 | |
| 225 | Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), |
| 226 | *month* (``1``--``12``), *day* (``1``--``31``). |
| 227 | |
| 228 | |
| 229 | .. function:: weekheader(n) |
| 230 | |
| 231 | Return a header containing abbreviated weekday names. *n* specifies the width in |
| 232 | characters for one weekday. |
| 233 | |
| 234 | |
| 235 | .. function:: monthrange(year, month) |
| 236 | |
| 237 | Returns weekday of first day of the month and number of days in month, for the |
| 238 | specified *year* and *month*. |
| 239 | |
| 240 | |
| 241 | .. function:: monthcalendar(year, month) |
| 242 | |
| 243 | Returns a matrix representing a month's calendar. Each row represents a week; |
| 244 | days outside of the month a represented by zeros. Each week begins with Monday |
| 245 | unless set by :func:`setfirstweekday`. |
| 246 | |
| 247 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 248 | .. function:: prmonth(theyear, themonth, w=0, l=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 249 | |
| 250 | Prints a month's calendar as returned by :func:`month`. |
| 251 | |
| 252 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 253 | .. function:: month(theyear, themonth, w=0, l=0) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 254 | |
| 255 | Returns a month's calendar in a multi-line string using the :meth:`formatmonth` |
| 256 | of the :class:`TextCalendar` class. |
| 257 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 258 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 259 | .. function:: prcal(year, w=0, l=0, c=6, m=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 260 | |
| 261 | Prints the calendar for an entire year as returned by :func:`calendar`. |
| 262 | |
| 263 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 264 | .. function:: calendar(year, w=2, l=1, c=6, m=3) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 265 | |
Georg Brandl | 0d8f073 | 2009-04-05 22:20:44 +0000 | [diff] [blame] | 266 | Returns a 3-column calendar for an entire year as a multi-line string using |
| 267 | the :meth:`formatyear` of the :class:`TextCalendar` class. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 268 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 269 | |
| 270 | .. function:: timegm(tuple) |
| 271 | |
| 272 | An unrelated but handy function that takes a time tuple such as returned by the |
| 273 | :func:`gmtime` function in the :mod:`time` module, and returns the corresponding |
| 274 | Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In |
| 275 | fact, :func:`time.gmtime` and :func:`timegm` are each others' inverse. |
| 276 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 277 | |
| 278 | The :mod:`calendar` module exports the following data attributes: |
| 279 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 280 | .. data:: day_name |
| 281 | |
| 282 | An array that represents the days of the week in the current locale. |
| 283 | |
| 284 | |
| 285 | .. data:: day_abbr |
| 286 | |
| 287 | An array that represents the abbreviated days of the week in the current locale. |
| 288 | |
| 289 | |
| 290 | .. data:: month_name |
| 291 | |
| 292 | An array that represents the months of the year in the current locale. This |
| 293 | follows normal convention of January being month number 1, so it has a length of |
| 294 | 13 and ``month_name[0]`` is the empty string. |
| 295 | |
| 296 | |
| 297 | .. data:: month_abbr |
| 298 | |
| 299 | An array that represents the abbreviated months of the year in the current |
| 300 | locale. This follows normal convention of January being month number 1, so it |
| 301 | has a length of 13 and ``month_abbr[0]`` is the empty string. |
| 302 | |
| 303 | |
| 304 | .. seealso:: |
| 305 | |
| 306 | Module :mod:`datetime` |
| 307 | Object-oriented interface to dates and times with similar functionality to the |
| 308 | :mod:`time` module. |
| 309 | |
| 310 | Module :mod:`time` |
| 311 | Low-level time related functions. |
| 312 | |