I want to get the first day and last day of the month where a given date lies in. The date comes from a value in a UI field.

If I’m using a time picker I could say

var maxDay = dtpAttendance.MaxDate.Day;

But I’m trying to get it from a DateTime object. So if I have this…

DateTime dt = DateTime.today;

How to get first day and last day of the month from dt?

18 Answers
18

Leave a Reply

Your email address will not be published. Required fields are marked *