Thursday, 14 July 2016

Python: LocaleHTMLCalendar: Get locale specific calendar details in HTML form

calendar.LocaleHTMLCalendar(firstweekday=0, locale=None)
It is a subclass of HTMLCalendar used to get the month and date names in specified locale.
>>> import calendar
>>> cal1=calendar.LocaleHTMLCalendar(calendar.MONDAY, 'de_DE')
>>> print(cal1.formatmonth(2011, 11))
<table border="0" cellpadding="0" cellspacing="0" class="month">
<tr><th colspan="7" class="month">November 2011</th></tr>
<tr><th class="mon">Mo</th><th class="tue">Di</th><th class="wed">Mi</th><th class="thu">Do</th><th class="fri">Fr</th><th class="sat">Sa</th><th class="sun">So</th></tr>
<tr><td class="noday">&nbsp;</td><td class="tue">1</td><td class="wed">2</td><td class="thu">3</td><td class="fri">4</td><td class="sat">5</td><td class="sun">6</td></tr>
<tr><td class="mon">7</td><td class="tue">8</td><td class="wed">9</td><td class="thu">10</td><td class="fri">11</td><td class="sat">12</td><td class="sun">13</td></tr>
<tr><td class="mon">14</td><td class="tue">15</td><td class="wed">16</td><td class="thu">17</td><td class="fri">18</td><td class="sat">19</td><td class="sun">20</td></tr>
<tr><td class="mon">21</td><td class="tue">22</td><td class="wed">23</td><td class="thu">24</td><td class="fri">25</td><td class="sat">26</td><td class="sun">27</td></tr>
<tr><td class="mon">28</td><td class="tue">29</td><td class="wed">30</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td><td class="noday">&nbsp;</td></tr>
</table>


Previous                                                 Next                                                 Home

No comments:

Post a Comment