CSharp examples for System:DateTime Hour
0-23 hours from DateTime
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w .j ava 2 s .c o m*/ using HandyWork.Common.Time; public class Main{ /// <summary> /// 0-23 /// </summary> public static int Hour(this DateTime? dt) { if (dt == null) { return 0; } return dt.Value.Hour; } }