HTMLCalendar().formatyear

Calendar Module

formatyear(theyear, themonth, withyear=True)
theyearYear number for which calendar of the month is returned
widthOptional,default value is 3 , the columns or months in a row
HTMLCalendar() : returns yearly Calendar using HTML tags

import calendar
x=calendar.HTMLCalendar()
x.formatyear(theyear=2020,width=2)
Output
'<table border="0" cellpadding="0" cellspacing="0" class="year">\n<tr><th colspan="2" class="year">2020</th></tr><tr><td><table border="0" cellpadding="0" cellspacing="0" class="month">\n<tr><th colspan="7" class="month">January</th></tr>\n<tr><th class="mon">Mon</th><th class="tue">Tue</th><th class="wed">Wed</th><th class="thu">Thu</th><th class="fri">Fri</th><th class="sat">Sat</th><th class="sun">Sun</th></tr>\n<tr><td class="noday"> </td><td class="noday"> </td><td class="wed">1</td><td class="thu">2</td><td class="fri">3</td><td class="sat">4</td><td class="sun">5</td></tr>\n<tr><td class="mon">6</td><td class="tue">7</td><td class="wed">8</td><td class="thu">9</td><td class="fri">10</td><td class="sat">11</td><td class="sun">12</td></tr>\n<tr><td class="mon">13</td><td class="tue">14</td><td class="wed">15</td><td class="thu">16</td><td class="fri">17</td><td class="sat">18</td><td class="sun">19</td></tr>\n
-----------
-----------
\n<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>\n<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>\n<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>\n<tr><td class="mon">28</td><td class="tue">29</td><td class="wed">30</td><td class="thu">31</td><td class="noday"> </td><td class="noday"> </td><td class="noday"> </td></tr>\n</table>\n</td></tr></table>'
2020
January
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
2728293031  
February
MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
242526272829 
March
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
April
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
27282930   
May
MonTueWedThuFriSatSun
    123
45678910
11121314151617
18192021222324
25262728293031
June
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     
July
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
2728293031  
August
MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
24252627282930
31      
September
MonTueWedThuFriSatSun
 123456
78910111213
14151617181920
21222324252627
282930    
October
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 
November
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
30      
December
MonTueWedThuFriSatSun
 123456
78910111213
14151617181920
21222324252627
28293031   
Based on the setting of first day of the week, the calendar first weekday can be set. Week day number starts from 0 as Monday , 1 as Tuesday and ends at 6 as Sunday.
import calendar
x=calendar.HTMLCalendar()
x.setfirstweekday(4) # first week day is Friday
x.formatyear(theyear=2020,width=2)
Calendar Module in Python itermonthdays() itermonthdays2() itermonthdays3()




plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer