Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
10628 Widoki

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 .

Awatar
Odrzuć
Najlepsza odpowiedź

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..........

Awatar
Odrzuć
Najlepsza odpowiedź
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
Download Odoo 8 Rozwiązane
1
maj 22
26240
0
mar 17
4424
0
lis 16
8610
2
sty 16
5809
1
gru 23
21475