[edit] C# DateTime.Hour Property
The DateTime hour property simply returns the hour part of a datetime object in the 24 hour format (Military Time). So, 6:00 PM will be 18:00.
[edit] Syntax
DateTime variable = DateTime.Now;
[edit] Example
using System;
class Program
{
static void Main()
{
DateTime variable = DateTime.Now;
Console.WriteLine(variable.Hour);
Console.Read();
}
}
Output:
13
When I ran this code it was 1:39 PM here. So, it simply returns 13 for the hour part.
<= DateTime Tutorial
|