Returns 12:00am time for the date passed. Useful for date only search ranges start value - CSharp System

CSharp examples for System:DateTime Time

Description

Returns 12:00am time for the date passed. Useful for date only search ranges start value

Demo Code


using System;//from  w ww  .ja v  a2s .co  m

public class Main{
        /// <summary>
        /// Returns 12:00am time for the date passed.
        /// Useful for date only search ranges start value
        /// </summary>
        /// <param name="date">Date to convert</param>
        /// <returns></returns>
        public static DateTime BeginningOfDay(this DateTime date)
        {
            return date.Date;
        }
}

Related Tutorials