Whether the specified date a value assigned to it - CSharp System

CSharp examples for System:DateTime Calculate

Description

Whether the specified date a value assigned to it

Demo Code


using System;// www  .  ja v a 2  s .c  o  m

public class Main{
        /// <summary>
        ///     Whether the specified date a value assigned to it
        /// </summary>
        /// <remarks>
        ///     The specified date may be a UTC datetime or not, either way this function determines whether the date is NOT close
        ///     to the <see cref="DateTime.MinValue" />
        /// </remarks>
        public static bool HasValue(this DateTime dateTime)
        {
            return dateTime.ToUniversalTime() > DateTime.MinValue.ToUniversalTime();
        }
}

Related Tutorials