HiveBrain v1.2.0
Get Started
← Back to all entries
snippetcsharpCritical

How do I get the last day of a month?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
lastdayhowthemonthget

Problem

How can I find the last day of the month in C#?

For example, if I have the date 03/08/1980, how do I get the last day of month 8 (in this case 31)?

Solution

The last day of the month you get like this, which returns 31:

DateTime.DaysInMonth(1980, 08);

Code Snippets

DateTime.DaysInMonth(1980, 08);

Context

Stack Overflow Q#2493032, score: 942

Revisions (0)

No revisions yet.