Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10438 Lượt xem

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 .

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
Download Odoo 8 Đã xử lý
1
thg 5 22
25842
0
thg 3 17
4141
0
thg 11 16
8348
2
thg 1 16
5585
1
thg 12 23
21240