This returns a DateTime which represents the last minute of the DateTime passed as a parameter. - CSharp System

CSharp examples for System:DateTime Minute

Description

This returns a DateTime which represents the last minute of the DateTime passed as a parameter.

Demo Code


using System.Globalization;
using System.Windows.Forms;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from   ww w  .  jav  a  2 s .  co m

public class Main{
        // ---------------------------------------------------------------------------------------
        // EndTimeOfDate
        // This returns a DateTime which represents the last minute of the DateTime passed as 
        // a parameter.
        // This can be used to get and ending date used for the starting date in the selection
        // range for the MonthCalendar control.
        // ---------------------------------------------------------------------------------------
        public static DateTime EndTimeOfDate(DateTime oBasedUponDateTime)
        {
            DateTime oNewDateTime = new DateTime(oBasedUponDateTime.Year, oBasedUponDateTime.Month, oBasedUponDateTime.Day, 23, 59, 59, DateTimeKind.Local);
            return oNewDateTime;
        }
}

Related Tutorials