Gets a DateTime representing noon on the current date - CSharp System

CSharp examples for System:DateTime Calculate

Description

Gets a DateTime representing noon on the current date

Demo Code


using System;/*from ww  w.  j ava 2  s  . c om*/

public class Main{
        /// <summary>
      /// Gets a DateTime representing noon on the current date
      /// </summary>
      /// <param name="current">The current date</param>
      public static DateTime Noon(this DateTime current)
      {
         var noon = new DateTime(current.Year, current.Month, current.Day, 12, 0, 0);
         return noon;
      }
}

Related Tutorials