How to calculate first date and last date of month

How to calculate first date and last late of month by any other day of a particular month:

It is simple to get first date and last date of given date month,

How to calculate first date and last late of month by any other day of a particular month


public void get_First_Aand_last_date( DateTime date)
    {
        DateTime tempDate = Convert.ToDateTime(date);
        DateTime startOfMonth = new DateTime(tempDate.Year, tempDate.Month, 1);
        DateTime endOfMonth = startOfMonth.AddMonths(1).AddDays(-1);


    }


use this function ..................

Other Related Post :