datetime class : Hour getter

Description

Gets the hour portion represented by this instance.

Syntax

datetimeInstance.Hour

Arguments

None

Return value

ClassDescription
intHour portion of datetime (from 0 to 23).

Sample code

1:

datetime dt = new datetime(2016, 3, 4, 4, 13, 0);

2:

int hour = dt.Hour; // 4

Notes

It's a wrapper of the System.DateTime.Hour property.

Links for reference

Copyright © Cooker All rights reserved.