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

◆ millisecond()

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

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

Returns
The milliseconds component, expressed as a value between 0 and 999.
Examples
The following example demonstrates the xtd::date_time::millisecond 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
You can display the string representation of the xtd::date::time::millisecond property by using the "b" or "B" format specifier. For example, the following code displays a string that contains the number of milliseconds in a date and time to the console.
date_time date1(2008, 1, 1, 0, 30, 45, 125);
console::write_line("milliseconds: {0:b}", date1); // displays milliseconds: 125
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
You can also display the millisecond component together with the other components of a date and time value by using the "s" standard format specifier. For example:
date_time date2(2008, 1, 1, 0, 30, 45, 125);
Console.WriteLine("Date: {0:s}", date2);
// Displays the following output to the console:
// Date: 2008-01-01T00:30:45.1250000