#include <time_zone_info.h>
Represents any time zone in the world.
- Inheritance
- xtd::object → xtd::time_zone_info
- Implements
- xtd::icomparable <>, xtd::iequatable <>
- Namespace
- xtd
- Library
- xtd.core
- Note
- An instance of the time_zone_info class is immutable. Once an object has been instantiated, its values cannot be modified.
|
class | adjustement_rule |
| Provides information about a time zone adjustment, such as the transition to and from daylight saving time. More...
|
|
class | transition_time |
| Provides information about a specific time change, such as the change from daylight saving time to standard time or vice versa, in a particular time zone. More...
|
|
|
| object ()=default |
| Create a new instance of the ultimate base class object. More...
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. More...
|
|
template<typename object_t > |
std::unique_ptr< object_t > | memberwise_clone () const |
| Gets the type of the current instance. More...
|
|
static bool | equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are considered equal. More...
|
|
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
| Determines whether the specified object instances are the same instance. More...
|
|
◆ base_utc_offset()
ticks xtd::time_zone_info::base_utc_offset |
( |
| ) |
const |
|
inline |
Gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).
- Returns
- TimeSpan An object that indicates the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).
- Note
- Because BaseUtcOffset is a property of the time_zone_info object rather than the time_zone_info.AdjustmentRule object, the time_zone_info class applies a single offset from UTC to all of a time zone's adjustments. To reflect a time zone that has modified its offset from UTC, you must create a new time zone using the CreateCustomTimeZone method.
-
The BaseUtcOffset property differs from the GetUtcOffset method in the following ways:
- The BaseUtcOffset property returns the difference between UTC and the time zone's standard time; the GetUtcOffset method returns the difference between UTC and the time zone's time at a particular point in time.
- The GetUtcOffset method reflects the application of any adjustment rules to the time zone; the BaseUtcOffset property does not.
◆ compare_to() [1/2]
int32_t xtd::time_zone_info::compare_to |
( |
const time_zone_info & |
obj | ) |
const |
|
overridevirtualnoexcept |
Compares the current instance with another object of the same type.
- Parameters
-
obj | An object to compare with this instance. |
- Returns
- A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
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< time_zone_info >.
◆ compare_to() [2/2]
int32_t xtd::time_zone_info::compare_to |
( |
const object & |
obj | ) |
const |
|
overridevirtualnoexcept |
Compares the current instance with another object of the same type.
- Parameters
-
obj | An object to compare with this instance. |
- Returns
- A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
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. |
Reimplemented from xtd::icomparable< time_zone_info >.
◆ convert_time_to_utc()
Converts the specified date and time to Coordinated Universal Time (UTC).
- Parameters
-
dateTime | The date and time to convert. |
- Returns
- date_time The Coordinated Universal Time (UTC) that corresponds to the dateTime parameter. The xtd::date_time value's Kind property is always set to xtd::date_timeKind.Utc.
- Exceptions
-
ArgumentNullException | dateTime is null. |
ArgumentException | time_zone_info::Local().IsInvalidxtd::date_time(dateTime) returns true. |
◆ daylight_name()
const ustring& xtd::time_zone_info::daylight_name |
( |
| ) |
const |
|
inline |
Gets the display name for the current time zone's daylight saving time.
- Returns
- string The display name for the time zone's daylight saving time.
◆ display_name()
const ustring& xtd::time_zone_info::display_name |
( |
| ) |
const |
|
inline |
Gets the general display name that represents the time zone.
- Returns
- string The time zone's general display name.
◆ equals() [1/2]
Indicates whether the current object is equal to another object of the same type.
- Parameters
-
obj | An object to compare with this object. |
- Returns
- true if the current object is equal to the other parameter; otherwise, false.
Implements xtd::iequatable< time_zone_info >.
◆ equals() [2/2]
bool xtd::time_zone_info::equals |
( |
const object & |
obj | ) |
const |
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
- Parameters
-
obj | The object to compare with the current object. |
- Returns
- true if the specified object is equal to the current object. otherwise, false.
- Examples
- The following code example compares the current instance with another object.
Reimplemented from xtd::object.
◆ get_system_time_zones()
static const std::list<time_zone_info>& xtd::time_zone_info::get_system_time_zones |
( |
| ) |
|
|
static |
Returns a sorted collection of all the time zones about which information is available on the local system.
- Returns
- An read-only Array of time_zone_info objects.
◆ id()
const ustring& xtd::time_zone_info::id |
( |
| ) |
const |
|
inline |
Gets the time zone identifier.
- Returns
- string The time zone identifier.
◆ local()
◆ standard_name()
const ustring& xtd::time_zone_info::standard_name |
( |
| ) |
const |
|
inline |
Gets the display name for the time zone's standard time.
- Returns
- The display name of the time zone's standard time.
◆ supports_daylight_saving_time()
bool xtd::time_zone_info::supports_daylight_saving_time |
( |
| ) |
const |
|
inline |
Gets a value indicating whether the time zone has any daylight saving time rules.*.
- Returns
- bool true if the time zone supports daylight saving time; otherwise, false.
◆ time_find_system_time_zone_by_id()
Retrieves a time_zone_info object from the registry based on its identifier.
- Parameters
-
id | The time zone identifier, which corresponds to the Id property. |
- Returns
- An object whose identifier is the value of the id parameter.
- Exceptions
-
ArgumentNullException | The id parameter is null. |
TimeZoneNotFoundException | The time zone identifier specified by id was not found. This means that a registry key whose name matches id does not exist, or that the key exists but does not contain any time zone data. |
◆ to_string()
Returns a sxd::ustring that represents the current object.
- Returns
- A string that represents the current object.
- Examples
- The following code example demonstrates what to_string returns.
Reimplemented from xtd::object.
◆ utc()
Gets a time_zone_info object that represents the Coordinated Universal Time (UTC) zone.
- Returns
- time_zone_info An object that represents the Coordinated Universal Time (UTC) zone.
The documentation for this class was generated from the following file: