To Day End - CSharp System

CSharp examples for System:DateTime Day

Description

To Day End

Demo Code


using System;//w w w  . j  a v a  2  s .com

public class Main{
        public static DateTime ToDayEnd(this DateTime value)
        {
            DateTime shortDate = Convert.ToDateTime(value.ToShortDateString());
            return shortDate.AddDays(1).AddSeconds(-1);
        }
        public static DateTime ToDayEnd(this string value)
        {
            DateTime date = Convert.ToDateTime(value);
            DateTime shortDate = Convert.ToDateTime(date.ToShortDateString());
            return shortDate.AddDays(1).AddSeconds(-1);
        }
}

Related Tutorials