Get Date For Last Day Of Month - CSharp System

CSharp examples for System:DateTime Day

Description

Get Date For Last Day Of Month

Demo Code


using System.Globalization;
using System.Windows.Forms;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*  ww w. j  av a 2 s  .com*/

public class Main{
        // -----------------------------------------------------------------------
        // GetDateForLastDayOfMonth
        // -----------------------------------------------------------------------
        public static DateTime GetDateForLastDayOfMonth(DateTime oDateTime)
        {
            DateTime oLastDateInMonth = new DateTime(
                    oDateTime.Year,
                    oDateTime.Month,
                    DateTime.DaysInMonth(oDateTime.Year, oDateTime.Month)
                    );

            return oLastDateInMonth;
        }
}

Related Tutorials