Skip to Content
मेन्यू
This question has been flagged
2 Replies
10441 Views

I do not know how to get Last day of specific month . please I need helping  you to me for that .

Thank you for you .

Avatar
Discard
Best Answer

Hi,

first you have to import calender

and you can use monthrange() method.

monthrange(year, month)
    Returns weekday of first day of the month and number of days in month, for the specified year and month. 

for getting the last day of a month you can use this script:-

calendar.monthrange(year, month)[1] 


Hope this helps..........

Avatar
Discard
Best Answer
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

Avatar
Discard
Related Posts Replies Views Activity
1
मई 22
25854
0
मार्च 17
4159
0
नव॰ 16
8351
2
जन॰ 16
5588
1
दिस॰ 23
21250