xtd 0.2.0
Loading...
Searching...
No Matches

◆ hour()

uint32 xtd::date_time::hour ( ) const
noexcept

Gets the hour component of the date represented by this instance.

Returns
The hour component, expressed as a value between 0 and 23.
Examples
The following example demonstrates the xtd::date_time::hour property.
xtd::date_time moment(1999, 1, 13, 3, 57, 32, 11);
// year gets 1999.
uint32 year = moment.year();
// month gets 1 (January).
uint23_t month = moment.month();
// day gets 13.
uint23_t day = moment.day();
// hour gets 3.
uint23_t hour = moment.hour();
// minute gets 57.
uint23_t minute = moment.minute();
// second gets 32.
uint23_t second = moment.second();
// millisecond gets 11.
uint23_t millisecond = moment.millisecond();
uint32 minute() const noexcept
Gets the minute component of the date represented by this instance.
uint32 day() const noexcept
Gets the day of the month represented by this instance.
uint32 month() const noexcept
Gets the month component of the date represented by this instance.
uint32 year() const noexcept
Gets the year component of the date represented by this instance.
uint32 millisecond() const noexcept
Gets the milliseconds component of the date represented by this instance.
uint32 second() const noexcept
Gets the seconds component of the date represented by this instance.
uint32 hour() const noexcept
Gets the hour component of the date represented by this instance.
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:85
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
Remarks
The value of the xtd::date_time::hour property is always expressed using a 24-hour clock. To retrieve a string that represents the hour of a date and time using a 12-hour clock, call the xtd::date_time::to_string(string) method with the "x" format specifier. For example:
date_time date1(2008, 4, 1, 18, 53, 0);
console::write_line(date1.to_string("X")); // Displays 6
console::write_line("{0}, {1}", date1.to_string("X"), date1.to_string("a")); // Displays 6 PM
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...