Represents any time zone in the world.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.h:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Represents any time zone in the world.
Definition time_zone_info.h:38
#define core_export_
Define shared library export.
Definition core_export.h:13
- 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...
|
|
|
ticks | base_utc_offset () const noexcept |
| Gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).
|
|
const string & | daylight_name () const noexcept |
| Gets the display name for the current time zone's daylight saving time.
|
|
const string & | display_name () const noexcept |
| Gets the general display name that represents the time zone.
|
|
const string & | id () const noexcept |
| Gets the time zone identifier.
|
|
const string & | standard_name () const noexcept |
| Gets the display name for the time zone's standard time.
|
|
bool | supports_daylight_saving_time () const noexcept |
| Gets a value indicating whether the time zone has any daylight saving time rules.*.
|
|
|
int32 | compare_to (const time_zone_info &tzi) const noexcept override |
| Compares the current instance with another object of the same type.
|
|
bool | equals (const time_zone_info &tzi) const noexcept override |
| Indicates whether the current object is equal to another object of the same type.
|
|
std::vector< adjustement_rule > | get_adjustement_rules () const noexcept |
| Retrieves an array of xtd::time_zone_info::adjustment_rule objects that apply to the current xtd::time_zone_info object.
|
|
bool | is_daylight_saving_time (const xtd::date_time &date_time) const noexcept |
| Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current xtd::time_zone_info object.
|
|
xtd::string | to_string () const noexcept override |
| Returns a xtd::string that represents the current object.
|
|
virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object.
|
|
template<typename object_a_t , typename 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.
|
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type.
|
|
virtual type_object | get_type () const noexcept |
| Gets the type of the current instance.
|
|
template<typename object_t > |
xtd::uptr< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object.
|
|
template<typename object_a_t , typename 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<typename object_a_t , typename 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.
|
|
◆ base_utc_offset()
ticks xtd::time_zone_info::base_utc_offset |
( |
| ) |
const |
|
noexcept |
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.
◆ daylight_name()
const string & xtd::time_zone_info::daylight_name |
( |
| ) |
const |
|
noexcept |
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 string & xtd::time_zone_info::display_name |
( |
| ) |
const |
|
noexcept |
Gets the general display name that represents the time zone.
- Returns
- string The time zone's general display name.
◆ id()
const string & xtd::time_zone_info::id |
( |
| ) |
const |
|
noexcept |
Gets the time zone identifier.
- Returns
- string The time zone identifier.
◆ standard_name()
const string & xtd::time_zone_info::standard_name |
( |
| ) |
const |
|
noexcept |
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 |
|
noexcept |
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.
◆ local()
◆ 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.
◆ compare_to()
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 >.
◆ equals() [1/3]
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 >.
◆ get_adjustement_rules()
std::vector< adjustement_rule > xtd::time_zone_info::get_adjustement_rules |
( |
| ) |
const |
|
noexcept |
Retrieves an array of xtd::time_zone_info::adjustment_rule objects that apply to the current xtd::time_zone_info object.
- Returns
- An array of objects for this time zone.
◆ is_daylight_saving_time()
bool xtd::time_zone_info::is_daylight_saving_time |
( |
const xtd::date_time & |
date_time | ) |
const |
|
noexcept |
Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current xtd::time_zone_info object.
- Parameters
-
- Returns
- true if the date_time parameter is a daylight saving time; otherwise, false.
◆ to_string()
Returns a xtd::string that represents the current object.
- Returns
- A string that represents the current object.
- Examples
- The following code example demonstrates what to_string returns.
#include <xtd/xtd>
namespace examples {
namespace object_test {
class object1 :
public object {
};
}
}
auto main() -> int {
ptr<object> obj1 = new_ptr<examples::object_test::object1>();
ptr<object> obj2 = new_ptr<date_time>(1971, 1, 5, 23, 5, 0);
}
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.h:27
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Reimplemented from xtd::object.
◆ 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. |
◆ get_system_time_zones()
static const std::list< time_zone_info > & xtd::time_zone_info::get_system_time_zones |
( |
| ) |
|
|
staticnoexcept |
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.
◆ convert_time() [1/2]
Converts a time to the time in a particular time zone.
- Parameters
-
date_time | The date and time to convert. |
destination_time_zone | The time zone to convert dateTime to. |
- Returns
- The date and time in the destination time zone.
- Exceptions
-
◆ convert_time() [2/2]
Converts a time from one time zone to another.
- Parameters
-
date_time | The date and time to convert. |
source_time_zone | The time zone of date_time. |
destination_time_zone | The time zone to convert date_time to. |
- Returns
- The date and time in the destination time zone that corresponds to the dateTime parameter in the source time zone.
- Exceptions
-
◆ convert_time_by_system_time_zone_id() [1/2]
Converts a time to the time in another time zone based on the time zone's identifier.
- Parameters
-
date_time | The date and time to convert. |
destination_time_zone_id | The identifier of the destination time zone. |
- Returns
- The date and time in the destination time zone.
◆ convert_time_by_system_time_zone_id() [2/2]
Converts a time from one time zone to another based on time zone identifiers.
- Parameters
-
date_time | The date and time to convert. |
source_time_zone_id | The identifier of the source time zone. |
destintion_time_zone_id | The identifier of the destination time zone. |
- Returns
- The date and time in the destination time zone that corresponds to the dateTime parameter in the source time zone.
◆ convert_from_utc()
◆ convert_to_utc() [1/2]
◆ convert_to_utc() [2/2]
◆ 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. |
◆ equals() [2/3]
virtual bool xtd::object::equals |
( |
const object & |
obj | ) |
const |
|
virtualnoexcept |
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.
#include <xtd/console>
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
object3 = object1;
}
Reimplemented from xtd::object.
◆ equals() [3/3]
template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals |
( |
const object_a_t & |
object_a, |
|
|
const object_b_t & |
object_b |
|
) |
| |
|
inlinestaticnoexcept |
Determines whether the specified object instances are considered equal.
- Parameters
-
object_a | The first object to compare. |
object_b | The second object to compare. |
- Returns
- true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
- Examples
- The following code example compares different objects.
#include <xtd/console>
auto main() -> int {
string s1 = "Tom";
string s2 = "Carol";
s1 = "Tom";
s2 = "Tom";
s1 = "";
s2 = "Tom";
s1 = "Carol";
s2 = "";
s1 = "";
s2 = "";
}
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
The documentation for this class was generated from the following file: