# itermonthdays3()

 `month` Month number for which dates are required `year` Year number for which dates are required
itermonthdays3() : Returns an Iterator of tuples having day , month and year for the month.

Note that tuple will be returned per the days for the week starting from Previous month and for days for the week extended up to next month.
Year is our first or 0th element ( item ) of the tuple. Month is the second element ( item ) and day is the third element of the tuples.

``````import calendar
my_cal= calendar.Calendar()
for x in my_cal.itermonthdays3(2020,7):
print(x)``````
Output
``````(2020, 6, 29)
(2020, 6, 30)
(2020, 7, 1)
(2020, 7, 2)
(2020, 7, 3)
(2020, 7, 4)
(2020, 7, 5)
(2020, 7, 6)
-------------
-------------
(2020, 7, 27)
(2020, 7, 28)
(2020, 7, 29)
(2020, 7, 30)
(2020, 7, 31)
(2020, 8, 1)
(2020, 8, 2)``````
By updating the first day of the week we can get different elements of the iterator.
``````import calendar
my_cal= calendar.Calendar(firstweekday=3)
for x in my_cal.itermonthdays3(2020,7):
print(x)``````
Output
``````(2020, 6, 25)
(2020, 6, 26)
(2020, 6, 27)
(2020, 6, 28)
(2020, 6, 29)
(2020, 6, 30)
(2020, 7, 1)
(2020, 7, 2)
(2020, 7, 3)
(2020, 7, 4)
------------
------------
(2020, 7, 30)
(2020, 7, 31)
(2020, 8, 1)
(2020, 8, 2)
(2020, 8, 3)
(2020, 8, 4)
(2020, 8, 5)``````
As we are getting tuple as output, we can get first element ( item ) as year , 2nd as month and 3rd as day the month.
``````import calendar
my_cal= calendar.Calendar(firstweekday=3)
for x in my_cal.itermonthdays3(2020,7):
print('Year:',x[0],', Month : ',x[1],', Day : ',x[2])``````
Output
``````Year: 2020 , Month :  6 , Day :  25
Year: 2020 , Month :  6 , Day :  26
Year: 2020 , Month :  6 , Day :  27
Year: 2020 , Month :  6 , Day :  28
Year: 2020 , Month :  6 , Day :  29
Year: 2020 , Month :  6 , Day :  30
Year: 2020 , Month :  7 , Day :  1
Year: 2020 , Month :  7 , Day :  2
Year: 2020 , Month :  7 , Day :  3
Year: 2020 , Month :  7 , Day :  4
Year: 2020 , Month :  7 , Day :  5
----------------------------------
----------------------------------
Year: 2020 , Month :  7 , Day :  29
Year: 2020 , Month :  7 , Day :  30
Year: 2020 , Month :  7 , Day :  31
Year: 2020 , Month :  8 , Day :  1
Year: 2020 , Month :  8 , Day :  2
Year: 2020 , Month :  8 , Day :  3
Year: 2020 , Month :  8 , Day :  4
Year: 2020 , Month :  8 , Day :  5``````

Subscribe to our YouTube Channel here

## Subscribe

* indicates required
Subscribe to plus2net

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-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer