跳至内容
菜单
此问题已终结
2 回复
10367 查看

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 .

形象
丢弃
最佳答案

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

形象
丢弃
最佳答案
from calender import monthrange
from datetime import date
mdays = monthrange(year,month)[1]
date2 = date(year,month,mdays)

形象
丢弃
相关帖文 回复 查看 活动
1
5月 22
25618
0
3月 17
4052
0
11月 16
8309
2
1月 16
5520
1
12月 23
21132