TimeZoneInfo

TimeZoneInfo class

Represents an information destribing a particular time zone. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

class TimeZoneInfo : public System::IEquatable<TimeZoneInfoPtr>

Methods

MethodDescription
static void ClearCachedData()Clear cached time zone data.
static DateTime ConvertTime(DateTime, const TimeZoneInfoPtr&, const TimeZoneInfoPtr&)Convert time from one time zone to another.
static DateTimeOffset ConvertTime(const DateTimeOffset&, const TimeZoneInfoPtr&)Convert time to the time in a specified time zone.
static DateTime ConvertTime(DateTime, const TimeZoneInfoPtr&)Convert time to the time in a specified time zone.
static DateTime ConvertTimeBySystemTimeZoneId(DateTime, const String&)Convert time to the time in a specified time zone.
static DateTimeOffset ConvertTimeBySystemTimeZoneId(const DateTimeOffset&, const String&)Convert time to the time in a specified time zone.
static DateTime ConvertTimeBySystemTimeZoneId(DateTime, const String&, const String&)Convert time to the time in a specified time zone.
static DateTime ConvertTimeFromUtc(DateTime, const TimeZoneInfoPtr&)Converts UTC-time to the time in a specified time zone.
static DateTime ConvertTimeToUtc(DateTime, const TimeZoneInfoPtr&)Converts time to UTC-time.
static DateTime ConvertTimeToUtc(DateTime)Converts time to UTC-time.
static DateTime ConvertTimeToUtcNoThrow(DateTime)Converts time to UTC-time. FOR INTERNAL USE.
static TimeZoneInfoPtr CreateCustomTimeZone(const String&, TimeSpan, const String&, const String&, const String&, const ArrayPtr<AdjustmentRulePtr>&, bool)Creates a custom time zone.
static TimeZoneInfoPtr CreateCustomTimeZone(const String&, TimeSpan, const String&, const String&, const String&, const ArrayPtr<AdjustmentRulePtr>&)Creates a custom time zone.
static TimeZoneInfoPtr CreateCustomTimeZone(const String&, TimeSpan, const String&, const String&)Creates a custom time zone.
bool Equals(SharedPtr<Object>) override
bool Equals(TimeZoneInfoPtr) overrideDetermines if the the current and specified objects are equal.
virtual bool Equals(ptr)Compares objects using C# Object.Equals semantics.
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares reference type objects in C# style.
static bool Equals(float const&, float const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
static bool Equals(double const&, double const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
virtual bool FastCast(const Details::FastRttiBase&, void **) constFor internal purposes only.
static TimeZoneInfoPtr FindSystemTimeZoneById(const String&)Gets time zone with specified identifier.
TimeSpan get_BaseUtcOffset() constReturns an instance of TimeSpan that represents a time interval between the current time zone’s standard time and UTC time.
String get_DaylightName() constGets name for the current time zone’s daylight saving time.
String get_DisplayName() constGets name for the current time zone.
String get_Id() constReturns the identifier of the time zone represented by the current object.
static TimeZoneInfoPtr get_Local()Returns an instance of TimeZoneInfo that represents a local time zone.
String get_StandardName() constGets name for the current time zone’s standart time.
bool get_SupportsDaylightSavingTime() constGets flag indicating if time zone has daylight saving time rules.
static TimeZoneInfoPtr get_Utc()Returns an instance of TimeZoneInfo that represents a UTC time zone.
ArrayPtr<AdjustmentRulePtr> GetAdjustmentRules() constReturns an array consisting of AdjustmentRule objects that represent adjustment rules that apply to the current TimeZoneInfo object.
ArrayPtr<TimeSpan> GetAmbiguousTimeOffsets(DateTime) constGets UTC dates and times that a specified date and time can be mapped to.
ArrayPtr<TimeSpan> GetAmbiguousTimeOffsets(const DateTimeOffset&) constGets UTC dates and times that a specified date and time can be mapped to.
Detail::SmartPtrCounter * GetCounter()Gets reference counter data structure associated with the object.
int GetHashCode() const overrideAnalog of C# Object.GetHashCode() method. Enables hashing of custom objects.
static SharedPtr<System::Collections::ObjectModel::ReadOnlyCollection<TimeZoneInfoPtr>> GetSystemTimeZones()Gets sorted collection of all time zones available on the local system.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
TimeSpan GetUtcOffset(DateTime) constCalculates difference between time in this time zone and UTC time zone for a specified date and time.
TimeSpan GetUtcOffset(const DateTimeOffset&) constCalculates difference between time in this time zone and UTC time zone for a specified date and time.
static TimeSpan GetUtcOffsetFromUtc(DateTime, const TimeZoneInfoPtr&)Internal helper function that returns the UTC offset for a UTC-datetime in a specified time zone. FOR INTERNAL USE.
static TimeSpan GetUtcOffsetFromUtc(DateTime, const TimeZoneInfoPtr&, bool&, bool&)Internal helper function that returns the UTC offset for a UTC-datetime in a specified time zone. FOR INTERNAL USE.
TimeSpan GetUtcOffsetNoThrow(DateTime) constCalculates difference between time in this time zone and UTC time zone for a specified date and time. FOR INTERNAL USE.
bool HasSameRules(const TimeZoneInfoPtr&) constChecks if current and another time zones have the same adjustment rules.
virtual bool Is(const TypeInfo&) constCheck if object represents an instance of type described by targetType. Analog of C# ‘is’ operator.
bool IsAmbiguousTime(DateTime) constChecks if specified date and time is ambiguous and can be mapped to many UTC times.
bool IsAmbiguousTime(const DateTimeOffset&) constChecks if specified date and time is ambiguous and can be mapped to many UTC times.
bool IsDaylightSavingTime(DateTime) constChecks if specified date and time falls in range of daylight saving time.
bool IsDaylightSavingTime(const DateTimeOffset&) constChecks if specified date and time falls in range of daylight saving time.
bool IsDaylightSavingTimeNoThrow(DateTime) constChecks if specified date and time falls in range of daylight saving time.
bool IsInvalidTime(DateTime) constChecks if specified date and time is invalid.
void Lock()Implements C# lock() statement locking. Call directly or use LockContext sentry object.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
Object()Creates object. Initializes all internal data structures.
Object(Object const&)Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
Object& operator=(Object const&)Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
static bool ReferenceEquals(ptr const&, ptr const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t)Reference-compares value type object with nullptr.
bool ReferenceEquals(String const&, std::nullptr_t)Specialization of Object::ReferenceEquals for case of string and nullptr.
bool ReferenceEquals(String const&, String const&)Specialization of Object::ReferenceEquals for case of strings.
int RemovedSharedRefs(int)Decreases shared reference count by specified value.
virtual void SetTemplateWeakPtr(uint32_t)Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode.
int SharedCount() constGets current value of shared reference counter.
Object * SharedRefAdded()Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
int SharedRefRemovedSafe()Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
String ToString() const overrideAnalog of C# Object.ToString() method. Enables converting custom objects to string.
static DateTime TransitionTimeToDateTime(int32_t, const TransitionTime&)Helper function that converts a year and TransitionTime into a DateTime.
static const TypeInfo& Type()Implements C# typeof(System.Object) construct.
void Unlock()Implements C# lock() statement unlocking. Call directly or use LockContext sentry object.
Detail::SmartPtrCounter * WeakRefAdded()Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
void WeakRefRemoved()Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
virtual ~Object()Destroys object. Frees all internal data structures.

Typedefs

TypedefDescription
AdjustmentRulePtrAn alias for a shared pointer to an instance of AdjustmentRule class.

See Also