How to find the number of dates in a month with month number

Need to find the number of days in a month using month number

Eg:month input:01

From the input we get to know the month is January so output should be 31

Month input :02
the input we get to know the month is February so output should be 28

Hi,

We need to input not only month but also year because of leap year.

Can you try DateTime.DaysInMonth method as the following?

img20221012-4

Regards,

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.