Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
10604 Vistas

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
Descartar
Mejor respuesta

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

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
may 22
26220
0
mar 17
4411
0
nov 16
8586
2
ene 16
5789
1
dic 23
21445