CSharp examples for System:DateTime Format
Returns a datetime for the DateTime passed to it, but with zeroed time information.
using System.Globalization; using System.Windows.Forms; using System.Text; using System.Linq; using System.Collections.Generic; using System;/* w w w .j a va2 s . com*/ public class Main{ // --------------------------------------------------------------------------------------- // ThisHour // Returns a datetime for the DateTime passed to it, but with zeroed time information. //// --------------------------------------------------------------------------------------- public static DateTime ThisHour(DateTime oDateTime) { DateTime oNewDateTime = new DateTime( oDateTime.Year, oDateTime.Month, oDateTime.Day, oDateTime.Hour, 0, 0 ); return oNewDateTime; } }