System::DateTimeOffset class

DateTimeOffset class

Contains the date and time of day relative to Coordinated Universal Time. 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 DateTimeOffset

Methods

MethodDescription
Add(TimeSpan) constAdds a specified time interval to the DateTimeOffset object.
AddDays(double) constAdds a specified number of days to the DateTimeOffset object.
AddHours(double) constAdds a specified number of hours to the DateTimeOffset object.
AddMilliseconds(double) constAdds a specified number of milliseconds to the DateTimeOffset object.
AddMinutes(double) constAdds a specified number of minutes to the DateTimeOffset object.
AddMonths(int) constAdds a specified number of months to the DateTimeOffset object.
AddSeconds(double) constAdds a specified number of seconds to the DateTimeOffset object.
AddTicks(int64_t) constAdds a specified number of ticks to the DateTimeOffset object.
AddYears(int) constAdds a specified number of years to the DateTimeOffset object.
static Compare(const DateTimeOffset&, const DateTimeOffset&)Compares two DateTimeOffset objects.
CompareTo(const DateTimeOffset&) constCompares two DateTimeOffset objects.
CompareTo(const SharedPtr<Object>&) constCompares two DateTimeOffset objects.
DateTimeOffset()Default constructor.
DateTimeOffset(DateTime)Constructor.
DateTimeOffset(int64_t, TimeSpan)Constructor.
DateTimeOffset(DateTime, TimeSpan)Constructor.
DateTimeOffset(int, int, int, int, int, int, TimeSpan)Constructor.
DateTimeOffset(int, int, int, int, int, int, int, TimeSpan)Constructor.
DateTimeOffset(int, int, int, int, int, int, int, const SharedPtr<Globalization::Calendar>&, TimeSpan)Constructor.
static Equals(const DateTimeOffset&, const DateTimeOffset&)Checks if two DateTimeOffset objects represent the same time point.
Equals(const DateTimeOffset&) constChecks if two DateTimeOffset objects represents the same time point.
Equals(const SharedPtr<Object>&) constChecks if two DateTimeOffset objects represents the same time point.
EqualsExact(const DateTimeOffset&) constChecks if two DateTimeOffset objects represents the same time point and has the same offset.
EqualsExact(const SharedPtr<Object>&) constChecks if two DateTimeOffset objects represents the same time point and has the same offset.
static FromFileTime(int64_t)ConvertWindows file time to date and time with local time offset.
static FromUnixTimeMilliseconds(int64_t)Convert Unix-time to DateTimeOffset object.
static FromUnixTimeSeconds(int64_t)Convert Unix-time to DateTimeOffset object.
get_Date() constGets date component of the current object.
get_DateTime() constGets DateTime value.
get_Day() constGets day of the month of the current object.
get_DayOfWeek() constGets day of the week of the current object.
get_DayOfYear() constGets day of year of the current object.
get_Hour() constGets hour component of the current object.
get_LocalDateTime() constGets DateTime value that represents the local date and time.
get_Millisecond() constGets millisecond component of the current object.
get_Minute() constGets minute component of the current object.
get_Month() constGets month component of the current object.
static get_Now()Gets DateTimeOffset whose date and time are set to the current local-time and whose offset is set to local time’s offset.
get_Offset() constGets offset from UTC.
get_Second() constGets second component of the current object.
get_Ticks() constGets number of ticks of the current object.
get_TimeOfDay() constGets time of day of the current object.
get_UtcDateTime() constGets DateTime value that represents the UTC date and time.
static get_UtcNow()Gets DateTimeOffset whose date and time are set to the current UTC-time and whose offset is TimeSpan::Zero.
get_UtcTicks() constGets number of ticks of the current object in UTC time.
get_Year() constGets year component of the current object.
GetHashCode() constGets hash code for the current DateTimeOffset object.
IsNull() const
operator!=(const DateTimeOffset&) constDetermines if the current object and the specified DateTimeOffset object represent distinct date and time values.
operator!=(std::nullptr_t) const
operator+(TimeSpan) constReturns a new instance of DateTimeOffset class that represents the date and time value that is the sum of the value represented by the current object and the specified time span.
operator-(TimeSpan) constReturns a new instance of the DateTimeOffset class representing the date and time value which is the result of subtraction of the specified time span from the value represented by the current object.
operator-(const DateTimeOffset&) constReturns an instance of TimeSpan class that represents the time interval between the date and time values represented by the current and the specified objects.
operator<(const DateTimeOffset&) constDetermines if the current object represents the date and time value that is earlier than the value represented by the specified DateTimeOffset object.
operator<(std::nullptr_t) const
operator<=(const DateTimeOffset&) constDetermines if the current object represents the date and time value that is earlier than or the same as the value represented by the specified DateTimeOffset object.
operator<=(std::nullptr_t) const
operator==(const DateTimeOffset&) constDetermines if the current object and the specified DateTimeOffset object represent the same date and time value.
operator==(std::nullptr_t) const
operator>(const DateTimeOffset&) constDetermines if the current object represents the date and time value that is later than the value represented by the specified DateTimeOffset object.
operator>(std::nullptr_t) const
operator>=(const DateTimeOffset&) constDetermines if the current object represents the date and time value that is later than or the same as the value represented by the specified DateTimeOffset object.
operator>=(std::nullptr_t) const
static Parse(const String&)Converts the specified string to DateTimeOffset equivalent.
static Parse(const String&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles)Converts the specified string to DateTimeOffset object using the specified format provider and formatting style.
static ParseExact(const String&, const String&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles)Converts the specified string to DateTimeOffset object using the specified format, format provider and formatting style.
static ParseExact(const String&, const ArrayPtr<String>&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles)Converts the specified string to DateTimeOffset object using the specified formats, format provider and formatting style.
Subtract(TimeSpan) constSubtracts a specified time interval from the current object.
Subtract(const DateTimeOffset&) constSubtracts a specified DateTimeOffset value from the current object.
ToFileTime() constConverts current object to the Windows file time.
ToLocalTime() constConverts current object to a object that represents the local time,.
ToOffset(TimeSpan) constReplace current object offset by the specified offset.
ToString(const String&, const SharedPtr<IFormatProvider>&) constConverts current object to string using the specified format and format provider.
ToString(const SharedPtr<IFormatProvider>&) constConverts current object to string using the specified format provider.
ToString(const String&) constConverts current object to string using the specified format.
ToString() constConverts current object to string.
ToUniversalTime() constConverts current object to a object that represents the UTC time,.
ToUnixTimeMilliseconds() constGets milliseconds elapsed from Unix epoch start.
ToUnixTimeSeconds() constGets seconds elapsed from Unix epoch start.
static TryParse(const String&, DateTimeOffset&)Tries to converts the specified string to DateTimeOffset object.
static TryParse(const String&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles, DateTimeOffset&)Tries to converts the specified string to DateTimeOffset object using the specified format provider and formatting style.
static TryParseExact(const String&, const ArrayPtr<String>&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles, DateTimeOffset&)Tries to converts the specified string to DateTimeOffset object using the specified formats, format provider and formatting style.
static TryParseExact(const String&, const String&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles, DateTimeOffset&)Tries to converts the specified string to DateTimeOffset object using the specified format, format provider and formatting style.
static Type()Returns a TypeInfo object that represent TimeSpan structure.

Fields

FieldDescription
static constexpr MaxOffsetGets maximum offset in ticks.
static MaxValueGets greatest DateTimeOffset value.
static constexpr MinOffsetGets minimum offset in ticks.
static MinValueGets earliest DateTimeOffset value.
static UnixEpochGets Unix epoch start.

See Also