Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
10454 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Paras vastaus
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
toukok. 22
25875
0
maalisk. 17
4174
0
marrask. 16
8361
2
tammik. 16
5607
1
jouluk. 23
21262