Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
10432 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Beste antwoord
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
mei 22
25834
0
mrt. 17
4131
0
nov. 16
8344
2
jan. 16
5582
1
dec. 23
21228