Represents an instant in time, typically expressed as a date and time of day.
Public Fields | |
| static const date_time | max_value |
| Represents the largest possible value of xtd::date_time. This field is read-only. | |
| static const date_time | min_value |
| Represents the smallest possible value of xtd::date_time. This field is read-only. | |
Public Constructors | |
| date_time ()=default | |
| Initializes a new instance of the xtd::date_time structure. | |
| date_time (int64 ticks) | |
| Initializes a new instance of the xtd::date_time structure to a specified number of ticks. | |
| date_time (xtd::ticks ticks) | |
| Initializes a new instance of the xtd::date_time structure to a specified number of ticks. | |
| date_time (int64 ticks, xtd::date_time_kind kind) | |
| Initializes a new instance of the xtd::date_time structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time. | |
| date_time (xtd::ticks ticks, xtd::date_time_kind kind) | |
| Initializes a new instance of the xtd::date_time structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time. | |
| date_time (uint32 year, uint32 month, uint32 day) | |
| Initializes a new instance of the xtd::date_time structure to the specified year, month, and day. | |
| date_time (uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second) | |
| Initializes a new instance of the xttd::date_time structure to the specified year, month, day, hour, minute, and second. | |
| date_time (uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second, date_time_kind kind) | |
| Initializes a new instance of the xtd::date_time structure to the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC) or local time. | |
| date_time (uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second, uint32 millisecond) | |
| Initializes a new instance of the xtd::date_time structure to the specified year, month, day, hour, minute, second, and millisecond. | |
| date_time (uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second, uint32 millisecond, date_time_kind kind) | |
| Initializes a new instance of the xtd::date_time structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time. | |
| template<class clock_t, class duration_t = clock_t::duration> | |
| date_time (const std::chrono::time_point< clock_t, duration_t > &time_point) | |
| Initializes a new instance of the xtd::date_time structure to a specified time point. | |
| template<class clock_t, class duration_t = clock_t::duration> | |
| date_time (const std::chrono::time_point< clock_t, duration_t > &time_point, date_time_kind kind) | |
| Initializes a new instance of the xtd::date_time structure to a specified time point, and Coordinated Universal Time (UTC) or local time. | |
Public Properties | |
| date_time | date () const noexcept |
| Gets the date component of this instance. | |
| uint32 | day () const noexcept |
| Gets the day of the month represented by this instance. | |
| xtd::day_of_week | day_of_week () const noexcept |
| Gets the day of the week represented by this instance. | |
| uint32 | day_of_year () const noexcept |
| Gets the day of the year represented by this instance. | |
| uint32 | hour () const noexcept |
| Gets the hour component of the date represented by this instance. | |
| date_time_kind | kind () const noexcept |
| Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither. | |
| uint32 | millisecond () const noexcept |
| Gets the milliseconds component of the date represented by this instance. | |
| uint32 | minute () const noexcept |
| Gets the minute component of the date represented by this instance. | |
| uint32 | month () const noexcept |
| Gets the month component of the date represented by this instance. | |
| uint32 | second () const noexcept |
| Gets the seconds component of the date represented by this instance. | |
| int64 | ticks () const noexcept |
| Gets the number of ticks that represent the date and time of this instance. | |
| xtd::ticks | ticks_duration () const noexcept |
| Gets the number of ticks that represent the date and time of this instance. | |
| xtd::time_span | time_of_day () const noexcept |
| Gets the time of day for this instance. | |
| uint32 | year () const noexcept |
| Gets the year component of the date represented by this instance. | |
Public Methods | |
| date_time | add (const xtd::time_span &value) const |
| Returns a new xtd::date_time that adds the value of the specified xtd::time_span to the value of this instance. | |
| date_time | add_days (double value) const |
| Returns a new xtd::date_time that adds the specified number of days to the value of this instance. | |
| date_time | add_hours (double value) const |
| Returns a new xtd::date_time that adds the specified number of hours to the value of this instance. | |
| date_time | add_milliseconds (double value) const |
| Returns a new xtd::date_time that adds the specified number of milliseconds to the value of this instance. | |
| date_time | add_minutes (double value) const |
| Returns a new xtd::date_time that adds the specified number of minutes to the value of this instance. | |
| date_time | add_months (int32 months) const |
| Returns a new xtd::date_time that adds the specified number of months to the value of this instance. | |
| date_time | add_seconds (double value) const |
| Returns a new xtd::date_time that adds the specified number of seconds to the value of this instance. | |
| date_time | add_ticks (int64 value) const |
| Returns a new xtd::date_time that adds the specified number of ticks to the value of this instance. | |
| date_time | add_years (int32 value) const |
| Returns a new xtd::date_time that adds the specified number of years to the value of this instance. | |
| int32 | compare_to (const date_time &value) const noexcept override |
| Compares the current instance with another object of the same type. | |
| bool | equals (const object &obj) const noexcept override |
| Determines whether the specified object is equal to the current object. | |
| bool | equals (const date_time &other) const noexcept override |
| Indicates whether the current object is equal to another object of the same type. | |
| xtd::size | get_hash_code () const noexcept override |
| Serves as a hash function for a particular type. | |
| array< string > | get_date_time_formats () const noexcept |
| Converts the value of this instance to all the string representations supported by the standard date and time format specifiers. | |
| bool | is_daylight_saving_time () const noexcept |
| Indicates whether this instance of xtd::date_time is within the daylight saving time range for the current time zone. | |
| xtd::time_span | subtract (const date_time &value) const |
| Returns a new xtd::time_span that subtracts the specified date and time from the value of this instance. | |
| date_time | subtract (const xtd::time_span &value) const |
| Returns a new xtd::date_time that subtracts the specified duration from the value of this instance. | |
| int64 | to_binary () const |
| Serializes the current xtd::date_time object to a 64-bit binary value that subsequently can be used to recreate the xtd::date_time object. | |
| int64 | to_file_time () const |
| Converts the value of the current xtd::date_time object to a Windows file time. | |
| int64 | to_file_time_utc () const |
| Converts the value of the current xtd::date_time object to a Windows file time. | |
| date_time | to_local_time () const |
| Converts the value of the current xtd::date_time object to local time. | |
| const xtd::string | to_long_date_string () const |
| Converts the value of the current xtd::date_time object to its equivalent long date string representation. | |
| const xtd::string | to_long_time_string () const |
| Converts the value of the current xtd::date_time object to its equivalent long time string representation. | |
| const xtd::string | to_short_date_string () const |
| Converts the value of the current xtd::date_time object to its equivalent short date string representation. | |
| const xtd::string | to_short_time_string () const |
| Converts the value of the current xtd::date_time object to its equivalent short time string representation. | |
| xtd::string | to_string () const noexcept override |
| Converts the value of the current xtd::date_time object to its equivalent string representation using the formatting conventions of the current culture. | |
| xtd::string | to_string (const string &format) const |
| Converts the value of the current xtd::date_time object to its equivalent string representation using the specified format and the formatting conventions of the current culture. | |
| xtd::string | to_string (const string &format, const xtd::globalization::culture_info &culture) const override |
| Converts the value of the current xtd::date_time object to its equivalent string representation using the specified format and the formatting conventions of the current culture. | |
| xtd::string | to_string (const xtd::globalization::culture_info &culture) const |
| Converts the value of the current xtd::date_time object to its equivalent string representation using the specified culture. | |
| std::time_t | to_time_t () const |
| Converts the value of the current xtd::date_time object to std::time_t. | |
| std::tm | to_tm () const |
| Converts the value of the current xtd::date_time object to std::tm. | |
| date_time | to_universal_time () const |
| Converts the value of the current xtd::date_time object to Coordinated Universal Time (UTC). | |
Public Static Methods | |
| static date_time | now () noexcept |
| Gets a xtd::date_time object that is set to the current date and time on this computer, expressed as the local time. | |
| static date_time | today () noexcept |
| Gets the current date. | |
| static date_time | utc_now () noexcept |
| Gets a xtd::date_time object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC). | |
| static int32 | days_in_month (uint32 year, month_of_year month) |
| Returns the number of days in the specified month and year. | |
| static int32 | days_in_month (uint32 year, uint32 month) |
| Returns the number of days in the specified month and year. | |
| static date_time | from_binary (int64 date_data) |
| Deserializes a 64-bit binary value and recreates an original serialized xtd::date_time object. | |
| static date_time | from_file_time (int64 file_time) |
| Converts the specified Windows file time to an equivalent local time. | |
| static date_time | from_file_time_utc (int64 file_time) |
| Converts the specified Windows file time to an equivalent UTC time. | |
| static date_time | from_duration (const time_span &value) |
| Converts the specified xtd::time_span to an equivalent unspecified time. | |
| static date_time | from_duration (const time_span &value, date_time_kind kind) |
| Converts the specified xtd::time_span to an equivalent to Coordinated Universal Time (UTC) or local time.. | |
| static date_time | from_time_t (std::time_t value) |
| Converts the specified std::time_t to an equivalent unspecified time. | |
| static date_time | from_time_t (std::time_t value, date_time_kind kind) |
| Converts the specified std::time_t to an equivalent to Coordinated Universal Time (UTC) or local time. | |
| static date_time | from_tm (const std::tm &value) |
| Converts the specified std::tm to an equivalent unspecified time. | |
| static date_time | from_tm (const std::tm &value, date_time_kind kind) |
| Converts the specified std::tm to an equivalent to Coordinated Universal Time (UTC) or local time. | |
| static bool | is_leap_year (uint32 year) |
| Returns an indication whether the specified year is a leap year. | |
| static date_time | parse (const xtd::string &s) |
| Converts the string representation of a date and time to its xtd::date_time equivalent by using the conventions of the current culture. | |
| static date_time | parse (const xtd::string &s, const xtd::globalization::culture_info &culture) |
| Converts the string representation of a date and time to its xtd::date_time equivalent by using the conventions of the current culture. | |
| static date_time | specify_kind (const date_time &value, date_time_kind kind) |
| Creates a new xtd::date_time object that has the same number of ticks as the specified xtd::date_time, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified xtd::date_time_kind value. | |
| static xtd::string | sprintf (const string &format, const date_time &value) |
| Returns a xtd::string that represents the current xtd::date_time. | |
| static xtd::string | sprintf (const string &format, const date_time &value, const xtd::globalization::culture_info &culture) |
| Returns a xtd::string that represents the current xtd::date_time. | |
| static bool | try_parse (const string &s, date_time &result) noexcept |
| Converts the specified string representation of a date and time to its xtd::date_time equivalent and returns a value that indicates whether the conversion succeeded. | |
| static bool | try_parse (const string &s, date_time &result, const xtd::globalization::culture_info &culture) noexcept |
| Converts the specified string representation of a date and time to its xtd::date_time equivalent and returns a value that indicates whether the conversion succeeded. | |
| static bool | try_parse_exact (const string &text, const string &format, date_time &result) noexcept |
| static bool | try_parse_exact (const string &text, const string &format, date_time &result, const xtd::globalization::culture_info &culture) noexcept |
| static bool | try_parse_exact (const string &text, const array< string > &formats, date_time &result) noexcept |
| static bool | try_parse_exact (const string &text, const array< string > &formats, date_time &result, const xtd::globalization::culture_info &culture) noexcept |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
|
default |
Initializes a new instance of the xtd::date_time structure.
|
explicit |
Initializes a new instance of the xtd::date_time structure to a specified number of ticks.
| ticks | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
| xtd::argument_out_of_range_exception | ticks is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
|
explicit |
Initializes a new instance of the xtd::date_time structure to a specified number of ticks.
| ticks | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
| xtd::argument_out_of_range_exception | ticks is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
| xtd::date_time::date_time | ( | int64 | ticks, |
| xtd::date_time_kind | kind ) |
Initializes a new instance of the xtd::date_time structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time.
| ticks | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
| kind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | ticks is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
| xtd::date_time::date_time | ( | xtd::ticks | ticks, |
| xtd::date_time_kind | kind ) |
Initializes a new instance of the xtd::date_time structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time.
| ticks | A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar. |
| kind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | ticks is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
Initializes a new instance of the xtd::date_time structure to the specified year, month, and day.
| year | The year (1 through 9999). |
| month | The month (1 through 12). |
| day | The day (1 through the number of days in month). |
| xtd::argument_out_of_range_exception | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month. |
| xtd::date_time::date_time | ( | uint32 | year, |
| uint32 | month, | ||
| uint32 | day, | ||
| uint32 | hour, | ||
| uint32 | minute, | ||
| uint32 | second ) |
Initializes a new instance of the xttd::date_time structure to the specified year, month, day, hour, minute, and second.
| year | The year (1 through 9999). |
| month | The month (1 through 12). |
| day | The day (1 through the number of days in month). |
| hour | The hours (0 through 23). |
| minute | The minutes (0 through 59). |
| second | The seconds (0 through 59). |
| xtd::argument_out_of_range_exception | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month. -or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59. -or- second is less than 0 or greater than 59. |
| xtd::date_time::date_time | ( | uint32 | year, |
| uint32 | month, | ||
| uint32 | day, | ||
| uint32 | hour, | ||
| uint32 | minute, | ||
| uint32 | second, | ||
| date_time_kind | kind ) |
Initializes a new instance of the xtd::date_time structure to the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC) or local time.
| year | The year (1 through 9999). |
| month | The month (1 through 12). |
| day | The day (1 through the number of days in month). |
| hour | The hours (0 through 23). |
| minute | The minutes (0 through 59). |
| second | The seconds (0 through 59). |
| kind | One of the enumeration values that indicates whether year, month, day, hour, minute and second specify a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month. -or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59 -or- second is less than 0 or greater than 59. |
| xtd::date_time::date_time | ( | uint32 | year, |
| uint32 | month, | ||
| uint32 | day, | ||
| uint32 | hour, | ||
| uint32 | minute, | ||
| uint32 | second, | ||
| uint32 | millisecond ) |
Initializes a new instance of the xtd::date_time structure to the specified year, month, day, hour, minute, second, and millisecond.
| year | The year (1 through 9999). |
| month | The month (1 through 12). |
| day | The day (1 through the number of days in month). |
| hour | The hours (0 through 23). |
| minute | The minutes (0 through 59). |
| second | The seconds (0 through 59). |
| millisecond | The milliseconds (0 through 999). |
| xtd::argument_out_of_range_exception | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month. -or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59 -or- second is less than 0 or greater than 59 -or- millisecond is less than 0 or greater than 999. |
| xtd::date_time::date_time | ( | uint32 | year, |
| uint32 | month, | ||
| uint32 | day, | ||
| uint32 | hour, | ||
| uint32 | minute, | ||
| uint32 | second, | ||
| uint32 | millisecond, | ||
| date_time_kind | kind ) |
Initializes a new instance of the xtd::date_time structure to the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal Time (UTC) or local time.
| year | The year (1 through 9999). |
| month | The month (1 through 12). |
| day | The day (1 through the number of days in month). |
| hour | The hours (0 through 23). |
| minute | The minutes (0 through 59). |
| second | The seconds (0 through 59). |
| millisecond | The milliseconds (0 through 999). |
| kind | One of the enumeration values that indicates whether year, month, day, hour, minute and second specify a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | year is less than 1 or greater than 9999. -or- month is less than 1 or greater than 12. -or- day is less than 1 or greater than the number of days in month. -or- hour is less than 0 or greater than 23. -or- minute is less than 0 or greater than 59 -or- second is less than 0 or greater than 59 -or- millisecond is less than 0 or greater than 999. |
|
inline |
Initializes a new instance of the xtd::date_time structure to a specified time point.
| time_point | A std::chrono::time_point value. |
|
inline |
Initializes a new instance of the xtd::date_time structure to a specified time point, and Coordinated Universal Time (UTC) or local time.
| time_point | A std::chrono::time_point value. |
| kind | One of the enumeration values that indicates whether year, month, day, hour, minute and second specify a local time, Coordinated Universal Time (UTC), or neither. |
|
noexcept |
Gets the date component of this instance.
|
noexcept |
Gets the day of the month represented by this instance.
|
noexcept |
Gets the day of the week represented by this instance.
|
noexcept |
Gets the day of the year represented by this instance.
|
noexcept |
Gets the hour component of the date represented by this instance.
|
noexcept |
Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal Time (UTC), or neither.
|
noexcept |
Gets the milliseconds component of the date represented by this instance.
|
noexcept |
Gets the minute component of the date represented by this instance.
|
noexcept |
Gets the month component of the date represented by this instance.
|
noexcept |
Gets the seconds component of the date represented by this instance.
|
noexcept |
Gets the number of ticks that represent the date and time of this instance.
|
noexcept |
Gets the number of ticks that represent the date and time of this instance.
|
noexcept |
Gets the time of day for this instance.
|
noexcept |
Gets the year component of the date represented by this instance.
| date_time xtd::date_time::add | ( | const xtd::time_span & | value | ) | const |
Returns a new xtd::date_time that adds the value of the specified xtd::time_span to the value of this instance.
| value | A positive or negative time interval. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
| date_time xtd::date_time::add_days | ( | double | value | ) | const |
Returns a new xtd::date_time that adds the specified number of days to the value of this instance.
| value | A number of whole and fractional days. The value parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
| date_time xtd::date_time::add_hours | ( | double | value | ) | const |
Returns a new xtd::date_time that adds the specified number of hours to the value of this instance.
| value | A number of whole and fractional hours. The value parameter can be negative or positive.A number of whole and fractional hours. The value parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
| date_time xtd::date_time::add_milliseconds | ( | double | value | ) | const |
Returns a new xtd::date_time that adds the specified number of milliseconds to the value of this instance.
| value | A number of whole and fractional milliseconds. The value parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
| date_time xtd::date_time::add_minutes | ( | double | value | ) | const |
Returns a new xtd::date_time that adds the specified number of minutes to the value of this instance.
| value | A number of whole and fractional minutes. The value parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
Returns a new xtd::date_time that adds the specified number of months to the value of this instance.
| months | A number of months. The months parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. -or- months is less than -120,000 or greater than 120,000. |
| date_time xtd::date_time::add_seconds | ( | double | value | ) | const |
Returns a new xtd::date_time that adds the specified number of seconds to the value of this instance.
| value | A number of whole and fractional seconds. The value parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
Returns a new xtd::date_time that adds the specified number of ticks to the value of this instance.
| value | A number of 100-nanosecond ticks. The value parameter can be positive or negative. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
Returns a new xtd::date_time that adds the specified number of years to the value of this instance.
| value | A number of years. The value parameter can be negative or positive. |
| xtd::argument_out_of_range_exception | The resulting xtd::date_time is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
Compares the current instance with another object of the same type.
| value | An object to compare with this instance. |
| Value | Condition |
|---|---|
| Less than zero | This instance is less than obj. |
| Zero | This instance is equal to obj. |
| Greater than zero | This instance is greater than obj. |
Implements xtd::icomparable< date_time >.
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
true if the specified object is equal to the current object. otherwise, false. Reimplemented from xtd::object.
|
overridevirtualnoexcept |
Indicates whether the current object is equal to another object of the same type.
| other | An object to compare with this object. |
true if the current object is equal to the other parameter; otherwise, false. Implements xtd::iequatable< date_time >.
|
overridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
Converts the value of this instance to all the string representations supported by the standard date and time format specifiers.
|
noexcept |
Indicates whether this instance of xtd::date_time is within the daylight saving time range for the current time zone.
true if the value of the xtd::date_time::kind property is xtd::date_time_kind::local or xtd::date_time_kind::unspecified and the value of this instance ofxtd::date_time is within the daylight saving time range for the local time zone; false if xtd::date_time::kind is xtd::date_time_kind::utc. false. | xtd::time_span xtd::date_time::subtract | ( | const date_time & | value | ) | const |
Returns a new xtd::time_span that subtracts the specified date and time from the value of this instance.
| value | The date and time value to subtract. |
| xtd::argument_out_of_range_exception | The result is less than xtd::date_time:min_value or represents a time greater than xtd::date_time:max_value. |
| date_time xtd::date_time::subtract | ( | const xtd::time_span & | value | ) | const |
Returns a new xtd::date_time that subtracts the specified duration from the value of this instance.
| value | The time interval to subtract. |
| xtd::argument_out_of_range_exception | The result is less than xtd::date_time:min_value or represents a time greater than xtd::date_time:max_value. |
| int64 xtd::date_time::to_binary | ( | ) | const |
Serializes the current xtd::date_time object to a 64-bit binary value that subsequently can be used to recreate the xtd::date_time object.
| int64 xtd::date_time::to_file_time | ( | ) | const |
Converts the value of the current xtd::date_time object to a Windows file time.
| xtd::argument_out_of_range_exception | The resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC. |
| int64 xtd::date_time::to_file_time_utc | ( | ) | const |
Converts the value of the current xtd::date_time object to a Windows file time.
| xtd::argument_out_of_range_exception | The resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC. |
| date_time xtd::date_time::to_local_time | ( | ) | const |
Converts the value of the current xtd::date_time object to local time.
| Kind | Results |
|---|---|
| xtd::date_time_kind::utc | This instance of xtd::date_timextd::date_time is converted to local time. |
| xtd::date_time_kind::local | No conversion is performed. |
| xtd::date_time_kind::unspecified | This instance of xtd::date_time is assumed to be a UTC time, and the conversion is performed as if xtd::date_time::kind were xtd::date_time_kind::utc. |
| const xtd::string xtd::date_time::to_long_date_string | ( | ) | const |
Converts the value of the current xtd::date_time object to its equivalent long date string representation.
| const xtd::string xtd::date_time::to_long_time_string | ( | ) | const |
Converts the value of the current xtd::date_time object to its equivalent long time string representation.
| const xtd::string xtd::date_time::to_short_date_string | ( | ) | const |
Converts the value of the current xtd::date_time object to its equivalent short date string representation.
| const xtd::string xtd::date_time::to_short_time_string | ( | ) | const |
Converts the value of the current xtd::date_time object to its equivalent short time string representation.
|
overridevirtualnoexcept |
Converts the value of the current xtd::date_time object to its equivalent string representation using the formatting conventions of the current culture.
Reimplemented from xtd::object.
| xtd::string xtd::date_time::to_string | ( | const string & | format | ) | const |
Converts the value of the current xtd::date_time object to its equivalent string representation using the specified format and the formatting conventions of the current culture.
| format | A standard or custom date and time format string. |
| xtd::format_exception | The length of format is 1, and it is not a valid format characters -or- The length is greater than 1. |
| Format | Description | Examples |
|---|---|---|
"d" | Short date pattern. | 2009-06-15T13:45:30 -> 6/15/2009 (en-US) 2009-06-15T13:45:30 -> 15/06/2009 (fr-FR) 2009-06-15T13:45:30 -> 2009/06/15 (ja-JP) |
"D" | Long date pattern. | 2009-06-15T13:45:30 -> Monday, June 15, 2009 (en-US) 2009-06-15T13:45:30 -> понедельник, 15 июня 2009 г. (ru-RU) 2009-06-15T13:45:30 -> Montag, 15. Juni 2009 (de-DE) |
"f" | Full date/time pattern (short time). | 2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 13:45 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 1:45 μμ (el-GR) |
"F" | Full date/time pattern (long time). | 2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 13:45:30 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 1:45:30 μμ (el-GR) |
"g" | General date/time pattern (short time). | 2009-06-15T13:45:30 -> 6/15/2009 1:45 PM (en-US) 2009-06-15T13:45:30 -> 15/06/2009 13:45 (es-ES) 2009-06-15T13:45:30 -> 2009/6/15 13:45 (zh-CN) |
"G" | General date/time pattern (long time). | 2009-06-15T13:45:30 -> 6/15/2009 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 15/06/2009 13:45:30 (es-ES) 2009-06-15T13:45:30 -> 2009/6/15 13:45:30 (zh-CN) |
"M", "m" | Month/day pattern. | 2009-06-15T13:45:30 -> June 15 (en-US) 2009-06-15T13:45:30 -> 15. juni (da-DK) 2009-06-15T13:45:30 -> 15 Juni (id-ID) |
"O", "o" | round-trip date/time pattern. ISO 8601 | 2009-06-15T13:45:30 (date_time_kind::local) -> 2009-06-15T13:45:30.0000000-07:00 2009-06-15T13:45:30 (date_time_kind::utc) -> 2009-06-15T13:45:30.0000000Z 2009-06-15T13:45:30 (date_time_kind::unspecified) -> 2009-06-15T13:45:30.0000000 |
"R", "r" | RFC1123 pattern. | 2009-06-15T13:45:30 -> Mon, 15 Jun 2009 13:45:30 GMT |
"s" | Sortable date/time pattern. | 2009-06-15T13:45:30 (date_time_kind::local) -> 2009-06-15T13:45:30 2009-06-15T13:45:30 (date_time_kind::utc) -> 2009-06-15T13:45:30 |
"t" | Short time pattern. | 2009-06-15T13:45:30 -> 1:45 PM (en-US) 2009-06-15T13:45:30 -> 13:45 (hr-HR) 2009-06-15T13:45:30 -> 01:45 م (ar-EG) |
"T" | Long time pattern. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (hr-HR) 2009-06-15T13:45:30 -> 01:45:30 م (ar-EG) |
"u" | Universal sortable date/time pattern. | 2009-06-15T13:45:30 -> 2009-06-15 13:45:30Z |
"U" | Universal full date/time pattern. | 2009-06-15T13:45:30 -> Monday, June 15, 2009 8:45:30 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 20:45:30 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 8:45:30 μμ (el-GR) |
"Y", "y" | Year month pattern. | 2009-06-15T13:45:30 -> June 2009 (en-US) 2009-06-15T13:45:30 -> juni 2009 (da-DK) 2009-06-15T13:45:30 -> Juni 2009 (id-ID) |
| Any other single character | Unknown specifier. | Throws a run-time xtd::format_exception. |
| Format | Description | Examples |
|---|---|---|
"d" | The day of the month, from 1 to 31. | 2009-06-01T13:45:30 -> 1 |
"dd" | The day of the month, from 01 to 31. | 2009-06-01T13:45:30 -> 01 |
"ddd" | The abbreviated name of the day of the week. | 2009-06-15T13:45:30 -> Mon (en-US) 2009-06-15T13:45:30 -> Пн (ru-RU) 2009-06-15T13:45:30 -> lun. (fr-FR) |
"dddd" | The full name of the day of the week. | 2009-06-15T13:45:30 -> Monday (en-US) 2009-06-15T13:45:30 ->понедельник (ru-RU) 2009-06-15T13:45:30 -> lundi (fr-FR) |
"f" | The tenths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 6 2009-06-15T13:45:30.05 -> 0 |
"ff" | The hundredths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 61 2009-06-15T13:45:30.0050000 -> 00 |
"fff" | The milliseconds in a date and time value. | 6/15/2009 13:45:30.617 -> 617 6/15/2009 13:45:30.0005 -> 000 |
"ffff" | The ten thousandths of a second in a date and time value. | 2009-06-15T13:45:30.6175000 -> 6175 6/15/2009 13:45:30.000005 -> 0000 |
"fffff" | The hundred thousandths of a second in a date and time value. | 2009-06-15T13:45:30.6175400 -> 61754 6/15/2009 13:45:30.000005 -> 00000 |
"ffffff" | The millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175420 -> 617542 2009-06-15T13:45:30.0000005 -> 000000 |
"fffffff" | The ten millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175425 -> 6175425 2009-06-15T13:45:30.0001150 -> 0001150 |
"F" | If non-zero, the tenths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 6 2009-06-15T13:45:30.0500000 -> (no output) |
"FF" | If non-zero, the hundredths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 61 2009-06-15T13:45:30.0050000 -> (no output) |
"FFF" | If non-zero, the milliseconds in a date and time value. | 2009-06-15T13:45:30.6170000 -> 617 2009-06-15T13:45:30.0005000 -> (no output) |
"FFFF" | If non-zero, the ten thousandths of a second in a date and time value. | 2009-06-15T13:45:30.5275000 -> 5275 2009-06-15T13:45:30.0000500 -> (no output) |
"FFFFF" | If non-zero, the hundred thousandths of a second in a date and time value. | 2009-06-15T13:45:30.6175400 -> 61754 2009-06-15T13:45:30.0000050 -> (no output) |
"FFFFFF" | If non-zero, the millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175420 -> 617542 2009-06-15T13:45:30.0000005 -> (no output) |
"FFFFFFF" | If non-zero, the ten millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175425 -> 6175425 2009-06-15T13:45:30.0001150 -> 000115 |
"g", "gg" | The period or era. | 2009-06-15T13:45:30.6170000 -> A.D. |
"h" | The hour, using a 12-hour clock from 1 to 12. | 2009-06-15T01:45:30 -> 1 2009-06-15T13:45:30 -> 1 |
"hh" | The hour, using a 12-hour clock from 01 to 12. | 2009-06-15T01:45:30 -> 01 2009-06-15T13:45:30 -> 01 |
"H" | The hour, using a 24-hour clock from 0 to 23. | 2009-06-15T01:45:30 -> 1 2009-06-15T13:45:30 -> 13 |
"HH" | The hour, using a 24-hour clock from 00 to 23. | 2009-06-15T01:45:30 -> 01 2009-06-15T13:45:30 -> 13 |
"k" | Time zone information. | 2009-06-15T13:45:30, Kind Unspecified -> 2009-06-15T13:45:30, Kind Utc -> Z 2009-06-15T13:45:30, Kind Local -> -07:00 (depends on local computer settings) |
"m" | The minute, from 0 to 59. | 2009-06-15T01:09:30 -> 9 2009-06-15T13:29:30 -> 29 |
"mm" | The minute, from 00 to 59. | 2009-06-15T01:09:30 -> 09 2009-06-15T13:29:30 -> 29 |
"M" | The month, from 1 to 12. | 2009-06-15T13:45:30 -> 6 |
"MM" | The month, from 01 to 12. | 2009-06-15T13:45:30 -> 06 |
"MMM" | The abbreviated name of the month. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
"MMMM" | The full name of the month. | 2009-06-15T13:45:30 -> June (en-US) 2009-06-15T13:45:30 -> juni (da-DK) 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
"s" | The second, from 0 to 59. | 2009-06-15T13:45:09 -> 9 |
"ss" | The second, from 00 to 59. | 2009-06-15T13:45:09 -> 09 |
"t" | The first character of the AM/PM designator. | 2009-06-15T13:45:30 -> P (en-US) 2009-06-15T13:45:30 -> 午 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
"tt" | The AM/PM designator. | 2009-06-15T13:45:30 -> PM (en-US) 2009-06-15T13:45:30 -> 午後 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
"y" | The year, from 0 to 99. | 0001-01-01T00:00:00 -> 1 0900-01-01T00:00:00 -> 0 1900-01-01T00:00:00 -> 0 2009-06-15T13:45:30 -> 9 2019-06-15T13:45:30 -> 19 |
"yy" | The year, from 00 to 99. | 0001-01-01T00:00:00 -> 01 0900-01-01T00:00:00 -> 00 1900-01-01T00:00:00 -> 00 2019-06-15T13:45:30 -> 19 |
"yyy" | The year, with a minimum of three digits. | 0001-01-01T00:00:00 -> 001 0900-01-01T00:00:00 -> 000 1900-01-01T00:00:00 -> 900 2019-06-15T13:45:30 -> 019 |
"yyyy" | The year as a four-digit number. | 0001-01-01T00:00:00 -> 0001 0900-01-01T00:00:00 -> 0900 1900-01-01T00:00:00 -> 1900 2019-06-15T13:45:30 -> 2019 |
"yyyyy" | The year as a five-digit number. | 0001-01-01T00:00:00 -> 00001 2009-06-15T13:45:30 -> 02009 |
"z" | Hours offset from UTC, with no leading zeros. | 2009-06-15T13:45:30-07:00 -> -7 |
"zz" | Hours offset from UTC, with a leading zero for a single-digit value. | 2009-06-15T13:45:30-07:00 -> -07 |
"zzz" | Hours and minutes offset from UTC. | 2009-06-15T13:45:30-07:00 -> -07:00 |
":" | The time separator. | 2009-06-15T13:45:30 -> : (en-US) 2009-06-15T13:45:30 -> . (it-IT) 2009-06-15T13:45:30 -> : (ja-JP) |
"/" | The date separator. | 2009-06-15T13:45:30 -> / (en-US) 2009-06-15T13:45:30 -> - (ar-DZ) 2009-06-15T13:45:30 -> . (tr-TR) |
"\" | The escape character. | 2009-06-15T13:45:30 (h \h) -> 1 h |
| Any other character | The character is copied to the result string unchanged. | 2009-06-15T01:45:30 (arr hh:mm t) -> arr 01:45 A |
| Format | Description | Examples |
|---|---|---|
%a | The abbreviated weekday name. | 2009-06-15T13:45:30 -> Mon (en-US) 2009-06-15T13:45:30 -> Пн (ru-RU) 2009-06-15T13:45:30 -> lun. (fr-FR) |
%A | The full weekday name. | 2009-06-15T13:45:30 -> Monday (en-US) 2009-06-15T13:45:30 -> понедельник (ru-RU) 2009-06-15T13:45:30 -> lundi (fr-FR) |
%b | The abbreviated month name. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%B | The full month name. | 2009-06-15T13:45:30 -> June (en-US) 2009-06-15T13:45:30 -> juni (da-DK) 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
%c | The standard date and time string. | 2009-06-15T13:45:30 -> Mon Jun 15 13:45:30 2009 (en-US) 2009-06-15T13:45:30 -> 月 6/15 13:45:30 2009 (ja-JP) 2009-06-15T13:45:30 -> lun. 15 juin 13:45:30 2009 (fr-FR) |
%C | The first 2 digits of year as a decimal number (range [00,99]). | 0001-01-01T00:00:00 -> 00 0900-01-01T00:00:00 -> 09 1900-01-01T00:00:00 -> 19 2019-06-15T13:45:30 -> 20 |
%d | The day of the month as a decimal number (range [01,31]). | 2009-06-01T13:45:30 -> 01 |
%D | The equivalent of %m/%d/%y. | 2009-06-01T13:45:30 -> 06/01/09 |
%e | The day of the month as a decimal number (range [1,31]). | 2009-06-01T13:45:30 -> 1 |
%Ec | The alternative date and time string. | 2009-06-01T13:45:30 -> Mon Jun 1 13:45:30 2009 (en-US) 2009-06-01T13:45:30 -> 月 6/ 1 13:45:30 2009 (jp-JA) 2009-06-01T13:45:30 -> lun. 1 juin 13:45:30 2009 (fr-FR) |
%EC | The name of the base year (period) in the alternative representation. | 2009-06-01T13:45:30 -> 20 (en-US) 2009-06-01T13:45:30 -> 20 (jp-JA) 2009-06-01T13:45:30 -> 20 (fr-FR) |
%Ex | The alternative date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%EX | The alternative time representation. | 2009-06-01T13:45:30 -> 1:45:30 PM (en-US) 2009-06-01T13:45:30 -> 13:45:30 (jp-JA) 2009-06-01T13:45:30 -> 13:45:30 (fr-FR) |
%Ey | The year as offset from alternative calendar period %EC. | 2009-06-01T13:45:30 -> 09 (en-US) 2009-06-01T13:45:30 -> 09 (jp-JA) 2009-06-01T13:45:30 -> 09 (fr-FR) |
%EY | The year in the alternative representation. | 2009-06-01T13:45:30 -> 2009 (en-US) 2009-06-01T13:45:30 -> 2009 (jp-JA) 2009-06-01T13:45:30 -> 2009 (fr-FR) |
%F | The equivalent of %Y-%m-%d (the ISO 8601 date format). | 2009-06-01T13:45:30 -> 2009-06-01 |
%g | The last 2 digits of ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 09 |
%G | The ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 2009 |
%h | The %b synonym. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%H | The hour as a decimal number, 24 hour clock (range [00-23]). | 2009-06-01T13:45:30 -> 13 |
%I | The hour as a decimal number, 12 hour clock (range [01,12]). | 2009-06-01T13:45:30 -> 01 |
%j | The day of the year as a decimal number (range [001,366]). | 2009-06-01T13:45:30 -> 153 |
%m | The month as a decimal number (range [01,12]). | 2009-06-01T13:45:30 -> 06 |
%M | The minute as a decimal number (range [00,59]). | 2009-06-01T13:45:30 -> 30 |
%Od | The zero-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 01 |
%Oe | The one-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OH | The hour from 24-hour clock using the alternative numeric system. | 2009-06-15T13:45:30 -> 13 |
%OI | The hour from 12-hour clock using the alternative numeric system | 2009-06-15T13:45:30 -> 01 |
%Om | The month using the alternative numeric system. | 2009-06-15T13:45:30 -> 06 |
%OM | The minute using the alternative numeric system. | 2009-06-15T13:45:30 -> 45 |
%OS | The second using the alternative numeric system. | 2009-06-15T13:45:30 -> 30 |
%Ou | The weekday, where Monday is 1, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OU | The week of the year, as by %U, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%OV | The week of the year, as by %V, using the alternative numeric system. | 2009-06-01T13:45:30 -> 23 |
%Ow | The weekday, where Sunday is 0, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OW | The week of the year, as by %W, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%Oy | The last 2 digits of year using the alternative numeric system. | 2009-06-01T13:45:30 -> 09 |
%p | The a.m. / p.m. designator. | 2009-06-15T13:45:30 -> PM (en-US) 2009-06-15T13:45:30 -> 午後 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
%r | The localized 12-hour clock time. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%R | The equivalent of %H:%M. | 2009-06-15T13:45:30 -> 13:45 |
%S | The second as a decimal number (range [00,60]). | 2009-06-15T13:45:30 -> 30 |
%T | The equivalent of %H:%M:%S (the ISO 8601 time format). | 2009-06-15T13:45:30 -> 13:45:30 |
%u | The weekday as a decimal number, where Monday is 1 (ISO 8601 format) (range [1-7]). | 2009-06-01T13:45:30 -> 1 |
%U | The week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%V | The ISO 8601 week of the year (range [01,53]). | 2009-06-01T13:45:30 -> 23 |
%w | The weekday as a decimal number, where Sunday is 0 (range [0-6]). | 2009-06-01T13:45:30 -> 1 |
%W | The week of the year as a decimal number (Monday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%x | The localized date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%X | The localized time representation. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%y | The last 2 digits of year as a decimal number (range [00,99]). | 2009-06-01T13:45:30 -> 09 |
%Y | The year as a decimal number. | 2009-06-01T13:45:30 -> 2009 |
%z | The offset from UTC in the ISO 8601 format. | 2009-06-15T13:45:30+01:00 -> +0100 |
%Z | The time zone name or abbreviation. | 2009-06-15T13:45:30+01:00 -> Romance Standard Time |
%% | The literal %. The full conversion specification must be %%. | 2009-06-15T13:45:30 (%H %%) -> 13 % |
%n | The newline character. | 2009-06-15T13:45:30 (%H%nM) -> 13 45 |
%t | The horizontal tab character. | 2009-06-15T13:45:30 (%H%tM) -> 13 45 |
| Any other character | The character is copied to the result string unchanged. | 2009-06-15T01:45:30 (arr %H:%MT) -> arr 13:45T |
|
overridevirtual |
Converts the value of the current xtd::date_time object to its equivalent string representation using the specified format and the formatting conventions of the current culture.
| format | A standard or custom date and time format string. |
| culture | An xtd::globalization::culture_info object that contains culture information. |
| xtd::format_exception | The length of format is 1, and it is not a valid format characters -or- The length is greater than 1. |
| Format | Description | Examples |
|---|---|---|
"d" | Short date pattern. | 2009-06-15T13:45:30 -> 6/15/2009 (en-US) 2009-06-15T13:45:30 -> 15/06/2009 (fr-FR) 2009-06-15T13:45:30 -> 2009/06/15 (ja-JP) |
"D" | Long date pattern. | 2009-06-15T13:45:30 -> Monday, June 15, 2009 (en-US) 2009-06-15T13:45:30 -> понедельник, 15 июня 2009 г. (ru-RU) 2009-06-15T13:45:30 -> Montag, 15. Juni 2009 (de-DE) |
"f" | Full date/time pattern (short time). | 2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 13:45 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 1:45 μμ (el-GR) |
"F" | Full date/time pattern (long time). | 2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 13:45:30 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 1:45:30 μμ (el-GR) |
"g" | General date/time pattern (short time). | 2009-06-15T13:45:30 -> 6/15/2009 1:45 PM (en-US) 2009-06-15T13:45:30 -> 15/06/2009 13:45 (es-ES) 2009-06-15T13:45:30 -> 2009/6/15 13:45 (zh-CN) |
"G" | General date/time pattern (long time). | 2009-06-15T13:45:30 -> 6/15/2009 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 15/06/2009 13:45:30 (es-ES) 2009-06-15T13:45:30 -> 2009/6/15 13:45:30 (zh-CN) |
"M", "m" | Month/day pattern. | 2009-06-15T13:45:30 -> June 15 (en-US) 2009-06-15T13:45:30 -> 15. juni (da-DK) 2009-06-15T13:45:30 -> 15 Juni (id-ID) |
"O", "o" | round-trip date/time pattern. ISO 8601 | 2009-06-15T13:45:30 (date_time_kind::local) -> 2009-06-15T13:45:30.0000000-07:00 2009-06-15T13:45:30 (date_time_kind::utc) -> 2009-06-15T13:45:30.0000000Z 2009-06-15T13:45:30 (date_time_kind::unspecified) -> 2009-06-15T13:45:30.0000000 |
"R", "r" | RFC1123 pattern. | 2009-06-15T13:45:30 -> Mon, 15 Jun 2009 13:45:30 GMT |
"s" | Sortable date/time pattern. | 2009-06-15T13:45:30 (date_time_kind::local) -> 2009-06-15T13:45:30 2009-06-15T13:45:30 (date_time_kind::utc) -> 2009-06-15T13:45:30 |
"t" | Short time pattern. | 2009-06-15T13:45:30 -> 1:45 PM (en-US) 2009-06-15T13:45:30 -> 13:45 (hr-HR) 2009-06-15T13:45:30 -> 01:45 م (ar-EG) |
"T" | Long time pattern. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (hr-HR) 2009-06-15T13:45:30 -> 01:45:30 م (ar-EG) |
"u" | Universal sortable date/time pattern. | 2009-06-15T13:45:30 -> 2009-06-15 13:45:30Z |
"U" | Universal full date/time pattern. | 2009-06-15T13:45:30 -> Monday, June 15, 2009 8:45:30 PM (en-US) 2009-06-15T13:45:30 -> den 15 juni 2009 20:45:30 (sv-SE) 2009-06-15T13:45:30 -> Δευτέρα, 15 Ιουνίου 2009 8:45:30 μμ (el-GR) |
"Y", "y" | Year month pattern. | 2009-06-15T13:45:30 -> June 2009 (en-US) 2009-06-15T13:45:30 -> juni 2009 (da-DK) 2009-06-15T13:45:30 -> Juni 2009 (id-ID) |
| Any other single character | Unknown specifier. | Throws a run-time xtd::format_exception. |
| Format | Description | Examples |
|---|---|---|
"d" | The day of the month, from 1 to 31. | 2009-06-01T13:45:30 -> 1 |
"dd" | The day of the month, from 01 to 31. | 2009-06-01T13:45:30 -> 01 |
"ddd" | The abbreviated name of the day of the week. | 2009-06-15T13:45:30 -> Mon (en-US) 2009-06-15T13:45:30 -> Пн (ru-RU) 2009-06-15T13:45:30 -> lun. (fr-FR) |
"dddd" | The full name of the day of the week. | 2009-06-15T13:45:30 -> Monday (en-US) 2009-06-15T13:45:30 ->понедельник (ru-RU) 2009-06-15T13:45:30 -> lundi (fr-FR) |
"f" | The tenths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 6 2009-06-15T13:45:30.05 -> 0 |
"ff" | The hundredths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 61 2009-06-15T13:45:30.0050000 -> 00 |
"fff" | The milliseconds in a date and time value. | 6/15/2009 13:45:30.617 -> 617 6/15/2009 13:45:30.0005 -> 000 |
"ffff" | The ten thousandths of a second in a date and time value. | 2009-06-15T13:45:30.6175000 -> 6175 6/15/2009 13:45:30.000005 -> 0000 |
"fffff" | The hundred thousandths of a second in a date and time value. | 2009-06-15T13:45:30.6175400 -> 61754 6/15/2009 13:45:30.000005 -> 00000 |
"ffffff" | The millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175420 -> 617542 2009-06-15T13:45:30.0000005 -> 000000 |
"fffffff" | The ten millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175425 -> 6175425 2009-06-15T13:45:30.0001150 -> 0001150 |
"F" | If non-zero, the tenths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 6 2009-06-15T13:45:30.0500000 -> (no output) |
"FF" | If non-zero, the hundredths of a second in a date and time value. | 2009-06-15T13:45:30.6170000 -> 61 2009-06-15T13:45:30.0050000 -> (no output) |
"FFF" | If non-zero, the milliseconds in a date and time value. | 2009-06-15T13:45:30.6170000 -> 617 2009-06-15T13:45:30.0005000 -> (no output) |
"FFFF" | If non-zero, the ten thousandths of a second in a date and time value. | 2009-06-15T13:45:30.5275000 -> 5275 2009-06-15T13:45:30.0000500 -> (no output) |
"FFFFF" | If non-zero, the hundred thousandths of a second in a date and time value. | 2009-06-15T13:45:30.6175400 -> 61754 2009-06-15T13:45:30.0000050 -> (no output) |
"FFFFFF" | If non-zero, the millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175420 -> 617542 2009-06-15T13:45:30.0000005 -> (no output) |
"FFFFFFF" | If non-zero, the ten millionths of a second in a date and time value. | 2009-06-15T13:45:30.6175425 -> 6175425 2009-06-15T13:45:30.0001150 -> 000115 |
"g", "gg" | The period or era. | 2009-06-15T13:45:30.6170000 -> A.D. |
"h" | The hour, using a 12-hour clock from 1 to 12. | 2009-06-15T01:45:30 -> 1 2009-06-15T13:45:30 -> 1 |
"hh" | The hour, using a 12-hour clock from 01 to 12. | 2009-06-15T01:45:30 -> 01 2009-06-15T13:45:30 -> 01 |
"H" | The hour, using a 24-hour clock from 0 to 23. | 2009-06-15T01:45:30 -> 1 2009-06-15T13:45:30 -> 13 |
"HH" | The hour, using a 24-hour clock from 00 to 23. | 2009-06-15T01:45:30 -> 01 2009-06-15T13:45:30 -> 13 |
"k" | Time zone information. | 2009-06-15T13:45:30, Kind Unspecified -> 2009-06-15T13:45:30, Kind Utc -> Z 2009-06-15T13:45:30, Kind Local -> -07:00 (depends on local computer settings) |
"m" | The minute, from 0 to 59. | 2009-06-15T01:09:30 -> 9 2009-06-15T13:29:30 -> 29 |
"mm" | The minute, from 00 to 59. | 2009-06-15T01:09:30 -> 09 2009-06-15T13:29:30 -> 29 |
"M" | The month, from 1 to 12. | 2009-06-15T13:45:30 -> 6 |
"MM" | The month, from 01 to 12. | 2009-06-15T13:45:30 -> 06 |
"MMM" | The abbreviated name of the month. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
"MMMM" | The full name of the month. | 2009-06-15T13:45:30 -> June (en-US) 2009-06-15T13:45:30 -> juni (da-DK) 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
"s" | The second, from 0 to 59. | 2009-06-15T13:45:09 -> 9 |
"ss" | The second, from 00 to 59. | 2009-06-15T13:45:09 -> 09 |
"t" | The first character of the AM/PM designator. | 2009-06-15T13:45:30 -> P (en-US) 2009-06-15T13:45:30 -> 午 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
"tt" | The AM/PM designator. | 2009-06-15T13:45:30 -> PM (en-US) 2009-06-15T13:45:30 -> 午後 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
"y" | The year, from 0 to 99. | 0001-01-01T00:00:00 -> 1 0900-01-01T00:00:00 -> 0 1900-01-01T00:00:00 -> 0 2009-06-15T13:45:30 -> 9 2019-06-15T13:45:30 -> 19 |
"yy" | The year, from 00 to 99. | 0001-01-01T00:00:00 -> 01 0900-01-01T00:00:00 -> 00 1900-01-01T00:00:00 -> 00 2019-06-15T13:45:30 -> 19 |
"yyy" | The year, with a minimum of three digits. | 0001-01-01T00:00:00 -> 001 0900-01-01T00:00:00 -> 000 1900-01-01T00:00:00 -> 900 2019-06-15T13:45:30 -> 019 |
"yyyy" | The year as a four-digit number. | 0001-01-01T00:00:00 -> 0001 0900-01-01T00:00:00 -> 0900 1900-01-01T00:00:00 -> 1900 2019-06-15T13:45:30 -> 2019 |
"yyyyy" | The year as a five-digit number. | 0001-01-01T00:00:00 -> 00001 2009-06-15T13:45:30 -> 02009 |
"z" | Hours offset from UTC, with no leading zeros. | 2009-06-15T13:45:30-07:00 -> -7 |
"zz" | Hours offset from UTC, with a leading zero for a single-digit value. | 2009-06-15T13:45:30-07:00 -> -07 |
"zzz" | Hours and minutes offset from UTC. | 2009-06-15T13:45:30-07:00 -> -07:00 |
":" | The time separator. | 2009-06-15T13:45:30 -> : (en-US) 2009-06-15T13:45:30 -> . (it-IT) 2009-06-15T13:45:30 -> : (ja-JP) |
"/" | The date separator. | 2009-06-15T13:45:30 -> / (en-US) 2009-06-15T13:45:30 -> - (ar-DZ) 2009-06-15T13:45:30 -> . (tr-TR) |
"\" | The escape character. | 2009-06-15T13:45:30 (h \h) -> 1 h |
| Any other character | The character is copied to the result string unchanged. | 2009-06-15T01:45:30 (arr hh:mm t) -> arr 01:45 A |
| Format | Description | Examples |
|---|---|---|
%a | The abbreviated weekday name. | 2009-06-15T13:45:30 -> Mon (en-US) 2009-06-15T13:45:30 -> Пн (ru-RU) 2009-06-15T13:45:30 -> lun. (fr-FR) |
%A | The full weekday name. | 2009-06-15T13:45:30 -> Monday (en-US) 2009-06-15T13:45:30 -> понедельник (ru-RU) 2009-06-15T13:45:30 -> lundi (fr-FR) |
%b | The abbreviated month name. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%B | The full month name. | 2009-06-15T13:45:30 -> June (en-US) 2009-06-15T13:45:30 -> juni (da-DK) 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
%c | The standard date and time string. | 2009-06-15T13:45:30 -> Mon Jun 15 13:45:30 2009 (en-US) 2009-06-15T13:45:30 -> 月 6/15 13:45:30 2009 (ja-JP) 2009-06-15T13:45:30 -> lun. 15 juin 13:45:30 2009 (fr-FR) |
%C | The first 2 digits of year as a decimal number (range [00,99]). | 0001-01-01T00:00:00 -> 00 0900-01-01T00:00:00 -> 09 1900-01-01T00:00:00 -> 19 2019-06-15T13:45:30 -> 20 |
%d | The day of the month as a decimal number (range [01,31]). | 2009-06-01T13:45:30 -> 01 |
%D | The equivalent of %m/%d/%y. | 2009-06-01T13:45:30 -> 06/01/09 |
%e | The day of the month as a decimal number (range [1,31]). | 2009-06-01T13:45:30 -> 1 |
%Ec | The alternative date and time string. | 2009-06-01T13:45:30 -> Mon Jun 1 13:45:30 2009 (en-US) 2009-06-01T13:45:30 -> 月 6/ 1 13:45:30 2009 (jp-JA) 2009-06-01T13:45:30 -> lun. 1 juin 13:45:30 2009 (fr-FR) |
%EC | The name of the base year (period) in the alternative representation. | 2009-06-01T13:45:30 -> 20 (en-US) 2009-06-01T13:45:30 -> 20 (jp-JA) 2009-06-01T13:45:30 -> 20 (fr-FR) |
%Ex | The alternative date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%EX | The alternative time representation. | 2009-06-01T13:45:30 -> 1:45:30 PM (en-US) 2009-06-01T13:45:30 -> 13:45:30 (jp-JA) 2009-06-01T13:45:30 -> 13:45:30 (fr-FR) |
%Ey | The year as offset from alternative calendar period %EC. | 2009-06-01T13:45:30 -> 09 (en-US) 2009-06-01T13:45:30 -> 09 (jp-JA) 2009-06-01T13:45:30 -> 09 (fr-FR) |
%EY | The year in the alternative representation. | 2009-06-01T13:45:30 -> 2009 (en-US) 2009-06-01T13:45:30 -> 2009 (jp-JA) 2009-06-01T13:45:30 -> 2009 (fr-FR) |
%F | The equivalent of %Y-%m-%d (the ISO 8601 date format). | 2009-06-01T13:45:30 -> 2009-06-01 |
%g | The last 2 digits of ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 09 |
%G | The ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 2009 |
%h | The %b synonym. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%H | The hour as a decimal number, 24 hour clock (range [00-23]). | 2009-06-01T13:45:30 -> 13 |
%I | The hour as a decimal number, 12 hour clock (range [01,12]). | 2009-06-01T13:45:30 -> 01 |
%j | The day of the year as a decimal number (range [001,366]). | 2009-06-01T13:45:30 -> 153 |
%m | The month as a decimal number (range [01,12]). | 2009-06-01T13:45:30 -> 06 |
%M | The minute as a decimal number (range [00,59]). | 2009-06-01T13:45:30 -> 30 |
%Od | The zero-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 01 |
%Oe | The one-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OH | The hour from 24-hour clock using the alternative numeric system. | 2009-06-15T13:45:30 -> 13 |
%OI | The hour from 12-hour clock using the alternative numeric system | 2009-06-15T13:45:30 -> 01 |
%Om | The month using the alternative numeric system. | 2009-06-15T13:45:30 -> 06 |
%OM | The minute using the alternative numeric system. | 2009-06-15T13:45:30 -> 45 |
%OS | The second using the alternative numeric system. | 2009-06-15T13:45:30 -> 30 |
%Ou | The weekday, where Monday is 1, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OU | The week of the year, as by %U, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%OV | The week of the year, as by %V, using the alternative numeric system. | 2009-06-01T13:45:30 -> 23 |
%Ow | The weekday, where Sunday is 0, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OW | The week of the year, as by %W, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%Oy | The last 2 digits of year using the alternative numeric system. | 2009-06-01T13:45:30 -> 09 |
%p | The a.m. / p.m. designator. | 2009-06-15T13:45:30 -> PM (en-US) 2009-06-15T13:45:30 -> 午後 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
%r | The localized 12-hour clock time. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%R | The equivalent of %H:%M. | 2009-06-15T13:45:30 -> 13:45 |
%S | The second as a decimal number (range [00,60]). | 2009-06-15T13:45:30 -> 30 |
%T | The equivalent of %H:%M:%S (the ISO 8601 time format). | 2009-06-15T13:45:30 -> 13:45:30 |
%u | The weekday as a decimal number, where Monday is 1 (ISO 8601 format) (range [1-7]). | 2009-06-01T13:45:30 -> 1 |
%U | The week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%V | The ISO 8601 week of the year (range [01,53]). | 2009-06-01T13:45:30 -> 23 |
%w | The weekday as a decimal number, where Sunday is 0 (range [0-6]). | 2009-06-01T13:45:30 -> 1 |
%W | The week of the year as a decimal number (Monday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%x | The localized date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%X | The localized time representation. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%y | The last 2 digits of year as a decimal number (range [00,99]). | 2009-06-01T13:45:30 -> 09 |
%Y | The year as a decimal number. | 2009-06-01T13:45:30 -> 2009 |
%z | The offset from UTC in the ISO 8601 format. | 2009-06-15T13:45:30+01:00 -> +0100 |
%Z | The time zone name or abbreviation. | 2009-06-15T13:45:30+01:00 -> Romance Standard Time |
%% | The literal %. The full conversion specification must be %%. | 2009-06-15T13:45:30 (%H %%) -> 13 % |
%n | The newline character. | 2009-06-15T13:45:30 (%H%nM) -> 13 45 |
%t | The horizontal tab character. | 2009-06-15T13:45:30 (%H%tM) -> 13 45 |
| Any other character | The character is copied to the result string unchanged. | 2009-06-15T01:45:30 (arr %H:%MT) -> arr 13:45T |
Implements xtd::iformatable.
| xtd::string xtd::date_time::to_string | ( | const xtd::globalization::culture_info & | culture | ) | const |
Converts the value of the current xtd::date_time object to its equivalent string representation using the specified culture.
| culture | An xtd::globalization::culture_info object that contains culture information. |
| std::time_t xtd::date_time::to_time_t | ( | ) | const |
Converts the value of the current xtd::date_time object to std::time_t.
| std::tm xtd::date_time::to_tm | ( | ) | const |
Converts the value of the current xtd::date_time object to std::tm.
| date_time xtd::date_time::to_universal_time | ( | ) | const |
Converts the value of the current xtd::date_time object to Coordinated Universal Time (UTC).
| Kind | Results |
|---|---|
| xtd::date_time_kind::utc | No conversion is performed. |
| xtd::date_time_kind::local | The current xtd::date_time object is converted to UTC. |
| xtd::date_time_kind::unspecified | The current xtd::date_time object is assumed to be a local time, and the conversion is performed as if xtd::date_time::kind were Local. |
|
staticnoexcept |
Gets a xtd::date_time object that is set to the current date and time on this computer, expressed as the local time.
|
staticnoexcept |
Gets the current date.
|
staticnoexcept |
Gets a xtd::date_time object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).
|
static |
Returns the number of days in the specified month and year.
| year | The year. |
| month | The month (one of xtd::month_of_year values). |
| xtd::argument_out_of_range_exception | month is less than 1 or greater than 12. -or- year is less than 1 or greater than 9999. |
Returns the number of days in the specified month and year.
| year | The year. |
| month | The month (a number ranging from 1 to 12). |
| xtd::argument_out_of_range_exception | month is less than 1 or greater than 12. -or- year is less than 1 or greater than 9999. |
Deserializes a 64-bit binary value and recreates an original serialized xtd::date_time object.
| date_data | A 64-bit signed integer that encodes the xtd::date_time::kind property in a 2-bit field and the xtd::date_time::ticks property in a 62-bit field. |
| xtd::argument_exception | date_data is less than xtd::date_time::min_value or greater than xtd::date_time::max_value. |
Converts the specified Windows file time to an equivalent local time.
| file_time | A Windows file time expressed in ticks. |
| xtd::argument_out_of_range_exception | file_time is less than 0 or represents a time greater than xtd::date_time:max_value. |
Converts the specified Windows file time to an equivalent UTC time.
| file_time | A Windows file time expressed in ticks. |
| xtd::argument_out_of_range_exception | file_time is less than 0 or represents a time greater than xtd::date_time:max_value. |
Converts the specified xtd::time_span to an equivalent unspecified time.
| value | A time interval from the start of the Clock's epoch. |
| xtd::argument_out_of_range_exception | value is less than xtd::date_time:min_value or represents a time greater than xtd::date_time:max_value. |
|
static |
Converts the specified xtd::time_span to an equivalent to Coordinated Universal Time (UTC) or local time..
| value | A time interval from the start of the Clock's epoch. |
| kind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | value is less than xtd::date_time:min_value or represents a time greater than xtd::date_time:max_value. |
|
static |
Converts the specified std::time_t to an equivalent unspecified time.
| value | A time interval from the start of the Clock's epoch. |
| xtd::argument_out_of_range_exception | value is less than xtd::date_time:min_value or represents a time greater than xtd::date_time:max_value. |
|
static |
Converts the specified std::time_t to an equivalent to Coordinated Universal Time (UTC) or local time.
| value | A time interval from the start of the Clock's epoch. |
| kind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | value is less than xtd::date_time:min_value or represents a time greater than xtd::date_time:max_value. |
|
static |
Converts the specified std::tm to an equivalent unspecified time.
| value | A std::tm struct. |
| xtd::argument_out_of_range_exception | value.ttm_year is less than 1 or greater than 9999. -or- tvalue.tm_mon is less than 1 or greater than 12. -or- value.tm_mday is less than 1 or greater than the number of days in month. -or- value.tm_hour is less than 0 or greater than 23. -or- value.tm_min is less than 0 or greater than 59 -or- vale.tm_sec is less than 0 or greater than 59. |
|
static |
Converts the specified std::tm to an equivalent to Coordinated Universal Time (UTC) or local time.
| value | A std::tm struct. |
| kind | One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither. |
| xtd::argument_out_of_range_exception | value.ttm_year is less than 1 or greater than 9999. -or- tvalue.tm_mon is less than 1 or greater than 12. -or- value.tm_mday is less than 1 or greater than the number of days in month. -or- value.tm_hour is less than 0 or greater than 23. -or- value.tm_min is less than 0 or greater than 59 -or- vale.tm_sec is less than 0 or greater than 59. |
|
static |
Returns an indication whether the specified year is a leap year.
| year | A 4-digit year. |
true if year is a leap year; otherwise, false. | xtd::argument_out_of_range_exception | year is less than 1 or greater than 9999. |
|
static |
Converts the string representation of a date and time to its xtd::date_time equivalent by using the conventions of the current culture.
| s | A string that contains a date and time to convert. See The string to parse for more information. |
| xtd::format_exception | s does not contain a valid string representation of a date and time. |
|
static |
Converts the string representation of a date and time to its xtd::date_time equivalent by using the conventions of the current culture.
| s | A string that contains a date and time to convert. See The string to parse for more information. |
| xtd::format_exception | s does not contain a valid string representation of a date and time. |
|
static |
Creates a new xtd::date_time object that has the same number of ticks as the specified xtd::date_time, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified xtd::date_time_kind value.
| value | A date and time. |
| kind | One of the enumeration values that indicates whether the new object represents local time, UTC, or neither. |
|
static |
Returns a xtd::string that represents the current xtd::date_time.
| format | Format-control String. |
| value | The xtd::date_time object to format. |
| Format | Description | Examples |
|---|---|---|
%a | The abbreviated weekday name. | 2009-06-15T13:45:30 -> Mon (en-US) 2009-06-15T13:45:30 -> Пн (ru-RU) 2009-06-15T13:45:30 -> lun. (fr-FR) |
%A | The full weekday name. | 2009-06-15T13:45:30 -> Monday (en-US) 2009-06-15T13:45:30 -> понедельник (ru-RU) 2009-06-15T13:45:30 -> lundi (fr-FR) |
%b | The abbreviated month name. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%B | The full month name. | 2009-06-15T13:45:30 -> June (en-US) 2009-06-15T13:45:30 -> juni (da-DK) 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
%c | The standard date and time string. | 2009-06-15T13:45:30 -> Mon Jun 15 13:45:30 2009 (en-US) 2009-06-15T13:45:30 -> 月 6/15 13:45:30 2009 (ja-JP) 2009-06-15T13:45:30 -> lun. 15 juin 13:45:30 2009 (fr-FR) |
%C | The first 2 digits of year as a decimal number (range [00,99]). | 0001-01-01T00:00:00 -> 00 0900-01-01T00:00:00 -> 09 1900-01-01T00:00:00 -> 19 2019-06-15T13:45:30 -> 20 |
%d | The day of the month as a decimal number (range [01,31]). | 2009-06-01T13:45:30 -> 01 |
%D | The equivalent of %m/%d/%y. | 2009-06-01T13:45:30 -> 06/01/09 |
%e | The day of the month as a decimal number (range [1,31]). | 2009-06-01T13:45:30 -> 1 |
%Ec | The alternative date and time string. | 2009-06-01T13:45:30 -> Mon Jun 1 13:45:30 2009 (en-US) 2009-06-01T13:45:30 -> 月 6/ 1 13:45:30 2009 (jp-JA) 2009-06-01T13:45:30 -> lun. 1 juin 13:45:30 2009 (fr-FR) |
%EC | The name of the base year (period) in the alternative representation. | 2009-06-01T13:45:30 -> 20 (en-US) 2009-06-01T13:45:30 -> 20 (jp-JA) 2009-06-01T13:45:30 -> 20 (fr-FR) |
%Ex | The alternative date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%EX | The alternative time representation. | 2009-06-01T13:45:30 -> 1:45:30 PM (en-US) 2009-06-01T13:45:30 -> 13:45:30 (jp-JA) 2009-06-01T13:45:30 -> 13:45:30 (fr-FR) |
%Ey | The year as offset from alternative calendar period %EC. | 2009-06-01T13:45:30 -> 09 (en-US) 2009-06-01T13:45:30 -> 09 (jp-JA) 2009-06-01T13:45:30 -> 09 (fr-FR) |
%EY | The year in the alternative representation. | 2009-06-01T13:45:30 -> 2009 (en-US) 2009-06-01T13:45:30 -> 2009 (jp-JA) 2009-06-01T13:45:30 -> 2009 (fr-FR) |
%F | The equivalent of %Y-%m-%d (the ISO 8601 date format). | 2009-06-01T13:45:30 -> 2009-06-01 |
%g | The last 2 digits of ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 09 |
%G | The ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 2009 |
%h | The %b synonym. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%H | The hour as a decimal number, 24 hour clock (range [00-23]). | 2009-06-01T13:45:30 -> 13 |
%I | The hour as a decimal number, 12 hour clock (range [01,12]). | 2009-06-01T13:45:30 -> 01 |
%j | The day of the year as a decimal number (range [001,366]). | 2009-06-01T13:45:30 -> 153 |
%m | The month as a decimal number (range [01,12]). | 2009-06-01T13:45:30 -> 06 |
%M | The minute as a decimal number (range [00,59]). | 2009-06-01T13:45:30 -> 30 |
%Od | The zero-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 01 |
%Oe | The one-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OH | The hour from 24-hour clock using the alternative numeric system. | 2009-06-15T13:45:30 -> 13 |
%OI | The hour from 12-hour clock using the alternative numeric system | 2009-06-15T13:45:30 -> 01 |
%Om | The month using the alternative numeric system. | 2009-06-15T13:45:30 -> 06 |
%OM | The minute using the alternative numeric system. | 2009-06-15T13:45:30 -> 45 |
%OS | The second using the alternative numeric system. | 2009-06-15T13:45:30 -> 30 |
%Ou | The weekday, where Monday is 1, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OU | The week of the year, as by %U, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%OV | The week of the year, as by %V, using the alternative numeric system. | 2009-06-01T13:45:30 -> 23 |
%Ow | The weekday, where Sunday is 0, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OW | The week of the year, as by %W, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%Oy | The last 2 digits of year using the alternative numeric system. | 2009-06-01T13:45:30 -> 09 |
%p | The a.m. / p.m. designator. | 2009-06-15T13:45:30 -> PM (en-US) 2009-06-15T13:45:30 -> 午後 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
%r | The localized 12-hour clock time. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%R | The equivalent of %H:%M. | 2009-06-15T13:45:30 -> 13:45 |
%S | The second as a decimal number (range [00,60]). | 2009-06-15T13:45:30 -> 30 |
%T | The equivalent of %H:%M:%S (the ISO 8601 time format). | 2009-06-15T13:45:30 -> 13:45:30 |
%u | The weekday as a decimal number, where Monday is 1 (ISO 8601 format) (range [1-7]). | 2009-06-01T13:45:30 -> 1 |
%U | The week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%V | The ISO 8601 week of the year (range [01,53]). | 2009-06-01T13:45:30 -> 23 |
%w | The weekday as a decimal number, where Sunday is 0 (range [0-6]). | 2009-06-01T13:45:30 -> 1 |
%W | The week of the year as a decimal number (Monday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%x | The localized date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%X | The localized time representation. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%y | The last 2 digits of year as a decimal number (range [00,99]). | 2009-06-01T13:45:30 -> 09 |
%Y | The year as a decimal number. | 2009-06-01T13:45:30 -> 2009 |
%z | The offset from UTC in the ISO 8601 format. | 2009-06-15T13:45:30+01:00 -> +0100 |
%Z | The time zone name or abbreviation. | 2009-06-15T13:45:30+01:00 -> Romance Standard Time |
%% | The literal %. The full conversion specification must be %%. | 2009-06-15T13:45:30 (%H %%) -> 13 % |
%n | The newline character. | 2009-06-15T13:45:30 (%H%nM) -> 13 45 |
%t | The horizontal tab character. | 2009-06-15T13:45:30 (%H%tM) -> 13 45 |
| Any other character | The character is copied to the result string unchanged. | 2009-06-15T01:45:30 (arr %H:%MT) -> arr 13:45T |
|
static |
Returns a xtd::string that represents the current xtd::date_time.
| format | Format-control String. |
| value | The xtd::date_time object to format. |
| culture | An xtd::globalization::culture_info object that contains culture information. |
| Format | Description | Examples |
|---|---|---|
%a | The abbreviated weekday name. | 2009-06-15T13:45:30 -> Mon (en-US) 2009-06-15T13:45:30 -> Пн (ru-RU) 2009-06-15T13:45:30 -> lun. (fr-FR) |
%A | The full weekday name. | 2009-06-15T13:45:30 -> Monday (en-US) 2009-06-15T13:45:30 -> понедельник (ru-RU) 2009-06-15T13:45:30 -> lundi (fr-FR) |
%b | The abbreviated month name. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%B | The full month name. | 2009-06-15T13:45:30 -> June (en-US) 2009-06-15T13:45:30 -> juni (da-DK) 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
%c | The standard date and time string. | 2009-06-15T13:45:30 -> Mon Jun 15 13:45:30 2009 (en-US) 2009-06-15T13:45:30 -> 月 6/15 13:45:30 2009 (ja-JP) 2009-06-15T13:45:30 -> lun. 15 juin 13:45:30 2009 (fr-FR) |
%C | The first 2 digits of year as a decimal number (range [00,99]). | 0001-01-01T00:00:00 -> 00 0900-01-01T00:00:00 -> 09 1900-01-01T00:00:00 -> 19 2019-06-15T13:45:30 -> 20 |
%d | The day of the month as a decimal number (range [01,31]). | 2009-06-01T13:45:30 -> 01 |
%D | The equivalent of %m/%d/%y. | 2009-06-01T13:45:30 -> 06/01/09 |
%e | The day of the month as a decimal number (range [1,31]). | 2009-06-01T13:45:30 -> 1 |
%Ec | The alternative date and time string. | 2009-06-01T13:45:30 -> Mon Jun 1 13:45:30 2009 (en-US) 2009-06-01T13:45:30 -> 月 6/ 1 13:45:30 2009 (jp-JA) 2009-06-01T13:45:30 -> lun. 1 juin 13:45:30 2009 (fr-FR) |
%EC | The name of the base year (period) in the alternative representation. | 2009-06-01T13:45:30 -> 20 (en-US) 2009-06-01T13:45:30 -> 20 (jp-JA) 2009-06-01T13:45:30 -> 20 (fr-FR) |
%Ex | The alternative date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%EX | The alternative time representation. | 2009-06-01T13:45:30 -> 1:45:30 PM (en-US) 2009-06-01T13:45:30 -> 13:45:30 (jp-JA) 2009-06-01T13:45:30 -> 13:45:30 (fr-FR) |
%Ey | The year as offset from alternative calendar period %EC. | 2009-06-01T13:45:30 -> 09 (en-US) 2009-06-01T13:45:30 -> 09 (jp-JA) 2009-06-01T13:45:30 -> 09 (fr-FR) |
%EY | The year in the alternative representation. | 2009-06-01T13:45:30 -> 2009 (en-US) 2009-06-01T13:45:30 -> 2009 (jp-JA) 2009-06-01T13:45:30 -> 2009 (fr-FR) |
%F | The equivalent of %Y-%m-%d (the ISO 8601 date format). | 2009-06-01T13:45:30 -> 2009-06-01 |
%g | The last 2 digits of ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 09 |
%G | The ISO 8601 week-based year. | 2009-06-01T13:45:30 -> 2009 |
%h | The %b synonym. | 2009-06-15T13:45:30 -> Jun (en-US) 2009-06-15T13:45:30 -> juin (fr-FR) 2009-06-15T13:45:30 -> Jun (zu-ZA) |
%H | The hour as a decimal number, 24 hour clock (range [00-23]). | 2009-06-01T13:45:30 -> 13 |
%I | The hour as a decimal number, 12 hour clock (range [01,12]). | 2009-06-01T13:45:30 -> 01 |
%j | The day of the year as a decimal number (range [001,366]). | 2009-06-01T13:45:30 -> 153 |
%m | The month as a decimal number (range [01,12]). | 2009-06-01T13:45:30 -> 06 |
%M | The minute as a decimal number (range [00,59]). | 2009-06-01T13:45:30 -> 30 |
%Od | The zero-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 01 |
%Oe | The one-based day of the month using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OH | The hour from 24-hour clock using the alternative numeric system. | 2009-06-15T13:45:30 -> 13 |
%OI | The hour from 12-hour clock using the alternative numeric system | 2009-06-15T13:45:30 -> 01 |
%Om | The month using the alternative numeric system. | 2009-06-15T13:45:30 -> 06 |
%OM | The minute using the alternative numeric system. | 2009-06-15T13:45:30 -> 45 |
%OS | The second using the alternative numeric system. | 2009-06-15T13:45:30 -> 30 |
%Ou | The weekday, where Monday is 1, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OU | The week of the year, as by %U, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%OV | The week of the year, as by %V, using the alternative numeric system. | 2009-06-01T13:45:30 -> 23 |
%Ow | The weekday, where Sunday is 0, using the alternative numeric system. | 2009-06-01T13:45:30 -> 1 |
%OW | The week of the year, as by %W, using the alternative numeric system. | 2009-06-01T13:45:30 -> 22 |
%Oy | The last 2 digits of year using the alternative numeric system. | 2009-06-01T13:45:30 -> 09 |
%p | The a.m. / p.m. designator. | 2009-06-15T13:45:30 -> PM (en-US) 2009-06-15T13:45:30 -> 午後 (ja-JP) 2009-06-15T13:45:30 -> (fr-FR) |
%r | The localized 12-hour clock time. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%R | The equivalent of %H:%M. | 2009-06-15T13:45:30 -> 13:45 |
%S | The second as a decimal number (range [00,60]). | 2009-06-15T13:45:30 -> 30 |
%T | The equivalent of %H:%M:%S (the ISO 8601 time format). | 2009-06-15T13:45:30 -> 13:45:30 |
%u | The weekday as a decimal number, where Monday is 1 (ISO 8601 format) (range [1-7]). | 2009-06-01T13:45:30 -> 1 |
%U | The week of the year as a decimal number (Sunday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%V | The ISO 8601 week of the year (range [01,53]). | 2009-06-01T13:45:30 -> 23 |
%w | The weekday as a decimal number, where Sunday is 0 (range [0-6]). | 2009-06-01T13:45:30 -> 1 |
%W | The week of the year as a decimal number (Monday is the first day of the week) (range [00,53]). | 2009-06-01T13:45:30 -> 22 |
%x | The localized date representation. | 2009-06-01T13:45:30 -> 6/1/2009 (en-US) 2009-06-01T13:45:30 -> 2009/06/01 (jp-JA) 2009-06-01T13:45:30 -> 01/06/2009 (fr-FR) |
%X | The localized time representation. | 2009-06-15T13:45:30 -> 1:45:30 PM (en-US) 2009-06-15T13:45:30 -> 13:45:30 (ja-JP) 2009-06-15T13:45:30 -> 13:45:30 (fr-FR) |
%y | The last 2 digits of year as a decimal number (range [00,99]). | 2009-06-01T13:45:30 -> 09 |
%Y | The year as a decimal number. | 2009-06-01T13:45:30 -> 2009 |
%z | The offset from UTC in the ISO 8601 format. | 2009-06-15T13:45:30+01:00 -> +0100 |
%Z | The time zone name or abbreviation. | 2009-06-15T13:45:30+01:00 -> Romance Standard Time |
%% | The literal %. The full conversion specification must be %%. | 2009-06-15T13:45:30 (%H %%) -> 13 % |
%n | The newline character. | 2009-06-15T13:45:30 (%H%nM) -> 13 45 |
%t | The horizontal tab character. | 2009-06-15T13:45:30 (%H%tM) -> 13 45 |
| Any other character | The character is copied to the result string unchanged. | 2009-06-15T01:45:30 (arr %H:%MT) -> arr 13:45T |
Converts the specified string representation of a date and time to its xtd::date_time equivalent and returns a value that indicates whether the conversion succeeded.
| s | A string containing a date and time to convert. |
| result | When this method returns, contains the xtd::date_time value equivalent to the date and time contained in s, if the conversion succeeded, or xtd::date_time::min_value if the conversion failed. The conversion fails if the s parameter is an empty string (""), or does not contain a valid string representation of a date and time. |
true if the s parameter was converted successfully; otherwise, false.
|
staticnoexcept |
Converts the specified string representation of a date and time to its xtd::date_time equivalent and returns a value that indicates whether the conversion succeeded.
| s | A string containing a date and time to convert. |
| result | When this method returns, contains the xtd::date_time value equivalent to the date and time contained in s, if the conversion succeeded, or xtd::date_time::min_value if the conversion failed. The conversion fails if the s parameter is an empty string (""), or does not contain a valid string representation of a date and time. |
true if the s parameter was converted successfully; otherwise, false.
|
static |
Represents the largest possible value of xtd::date_time. This field is read-only.
|
static |
Represents the smallest possible value of xtd::date_time. This field is read-only.