DateTimeOffset

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
DateTimeOffset Add(TimeSpan) constAdds a specified time interval to the DateTimeOffset object.
DateTimeOffset AddDays(double) constAdds a specified number of days to the DateTimeOffset object.
DateTimeOffset AddHours(double) constAdds a specified number of hours to the DateTimeOffset object.
DateTimeOffset AddMilliseconds(double) constAdds a specified number of milliseconds to the DateTimeOffset object.
DateTimeOffset AddMinutes(double) constAdds a specified number of minutes to the DateTimeOffset object.
DateTimeOffset AddMonths(int) constAdds a specified number of months to the DateTimeOffset object.
DateTimeOffset AddSeconds(double) constAdds a specified number of seconds to the DateTimeOffset object.
DateTimeOffset AddTicks(int64_t) constAdds a specified number of ticks to the DateTimeOffset object.
DateTimeOffset AddYears(int) constAdds a specified number of years to the DateTimeOffset object.
static int Compare(const DateTimeOffset&, const DateTimeOffset&)Compares two DateTimeOffset objects.
int CompareTo(const DateTimeOffset&) constCompares two DateTimeOffset objects.
int CompareTo(const SharedPtr<Object>&) constCompares two DateTimeOffset objects.
constexpr 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 bool Equals(const DateTimeOffset&, const DateTimeOffset&)Checks if two DateTimeOffset objects represent the same time point.
bool Equals(const DateTimeOffset&) constChecks if two DateTimeOffset objects represents the same time point.
bool Equals(const SharedPtr<Object>&) constChecks if two DateTimeOffset objects represents the same time point.
bool EqualsExact(const DateTimeOffset&) constChecks if two DateTimeOffset objects represents the same time point and has the same offset.
bool EqualsExact(const SharedPtr<Object>&) constChecks if two DateTimeOffset objects represents the same time point and has the same offset.
static DateTimeOffset FromFileTime(int64_t)ConvertWindows file time to date and time with local time offset.
static DateTimeOffset FromUnixTimeMilliseconds(int64_t)Convert Unix-time to DateTimeOffset object.
static DateTimeOffset FromUnixTimeSeconds(int64_t)Convert Unix-time to DateTimeOffset object.
DateTime get_Date() constGets date component of the current object.
DateTime get_DateTime() constGets DateTime value.
int get_Day() constGets day of the month of the current object.
DayOfWeek get_DayOfWeek() constGets day of the week of the current object.
int get_DayOfYear() constGets day of year of the current object.
int get_Hour() constGets hour component of the current object.
DateTime get_LocalDateTime() constGets DateTime value that represents the local date and time.
constexpr int get_Millisecond() constGets millisecond component of the current object.
int get_Minute() constGets minute component of the current object.
int get_Month() constGets month component of the current object.
static DateTimeOffset 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.
constexpr TimeSpan get_Offset() constGets offset from UTC.
constexpr int get_Second() constGets second component of the current object.
int64_t get_Ticks() constGets number of ticks of the current object.
TimeSpan get_TimeOfDay() constGets time of day of the current object.
DateTime get_UtcDateTime() constGets DateTime value that represents the UTC date and time.
static DateTimeOffset get_UtcNow()Gets DateTimeOffset whose date and time are set to the current UTC-time and whose offset is TimeSpan::Zero.
int64_t get_UtcTicks() constGets number of ticks of the current object in UTC time.
int get_Year() constGets year component of the current object.
int GetHashCode() constGets hash code for the current DateTimeOffset object.
constexpr bool IsNull() const
bool operator!=(const DateTimeOffset&) constDetermines if the current object and the specified DateTimeOffset object represent distinct date and time values.
constexpr bool operator!=(std::nullptr_t) const
DateTimeOffset 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.
DateTimeOffset 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.
TimeSpan 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.
bool 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.
constexpr bool operator<(std::nullptr_t) const
bool 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.
constexpr bool operator<=(std::nullptr_t) const
bool operator==(const DateTimeOffset&) constDetermines if the current object and the specified DateTimeOffset object represent the same date and time value.
constexpr bool operator==(std::nullptr_t) const
bool 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.
constexpr bool operator>(std::nullptr_t) const
bool 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.
constexpr bool operator>=(std::nullptr_t) const
static DateTimeOffset Parse(const String&)Converts the specified string to DateTimeOffset equivalent.
static DateTimeOffset Parse(const String&, const SharedPtr<IFormatProvider>&, Globalization::DateTimeStyles)Converts the specified string to DateTimeOffset object using the specified format provider and formatting style.
static DateTimeOffset 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 DateTimeOffset 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.
DateTimeOffset Subtract(TimeSpan) constSubtracts a specified time interval from the current object.
TimeSpan Subtract(const DateTimeOffset&) constSubtracts a specified DateTimeOffset value from the current object.
int64_t ToFileTime() constConverts current object to the Windows file time.
DateTimeOffset ToLocalTime() constConverts current object to a object that represents the local time,.
DateTimeOffset ToOffset(TimeSpan) constReplace current object offset by the specified offset.
String ToString(const String&, const SharedPtr<IFormatProvider>&) constConverts current object to string using the specified format and format provider.
String ToString(const SharedPtr<IFormatProvider>&) constConverts current object to string using the specified format provider.
String ToString(const String&) constConverts current object to string using the specified format.
String ToString() constConverts current object to string.
DateTimeOffset ToUniversalTime() constConverts current object to a object that represents the UTC time,.
int64_t ToUnixTimeMilliseconds() constGets milliseconds elapsed from Unix epoch start.
int64_t ToUnixTimeSeconds() constGets seconds elapsed from Unix epoch start.
static bool TryParse(const String&, DateTimeOffset&)Tries to converts the specified string to DateTimeOffset object.
static bool 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 bool 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 bool 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 const TypeInfo& 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