Gets the 11:59:59 instance of a DateTime - CSharp System

CSharp examples for System:DateTime Time

Description

Gets the 11:59:59 instance of a DateTime

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;// w ww.j  av a 2  s .  c o m

public class Main{
        public static DateTime? AbsoluteEnd(this DateTime? dateTime)
        {
            return dateTime.HasValue ? dateTime.Value.AbsoluteEnd() : (DateTime?)null;
        }
        /// <summary>
        /// Gets the 11:59:59 instance of a DateTime
        /// </summary>
        public static DateTime AbsoluteEnd(this DateTime dateTime)
        {
            return AbsoluteStart(dateTime).AddDays(1).AddTicks(-1);
        }
}

Related Tutorials