CSharp examples for System:DateTime Hour
Returns the FIRST possible time unit for provided Hour in dateTime
using System.Globalization; using System;/*from w ww . j a va 2 s .com*/ public class Main{ #endregion #region Start of Hour/Day/Week/Month/Year /// <summary> /// Returns the FIRST possible time unit for provided Hour in dateTime /// </summary> public static DateTime StartOfHour(this DateTime dateTime) { return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0); } }