Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
10391 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
kvě 22
25655
0
bře 17
4066
0
lis 16
8317
2
led 16
5536
1
pro 23
21168