To Day Start - CSharp System

CSharp examples for System:DateTime Day

Description

To Day Start

Demo Code


using System;//w w w  .  j  av a2  s.  c  o  m

public class Main{
        public static DateTime ToDayStart(this DateTime value)
        {
            string shortDate = value.ToShortDateString();
            return Convert.ToDateTime(shortDate);
        }
        public static DateTime ToDayStart(this string value)
        {
            DateTime date = Convert.ToDateTime(value);
            string shortDate = date.ToShortDateString();
            return Convert.ToDateTime(shortDate);
        }
}

Related Tutorials