CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::DateTimeOffset Class Referencefinal

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. More...

#include <date_time_offset.h>

Public Member Functions

constexpr DateTimeOffset ()=default
 Default constructor. More...
 
 DateTimeOffset (DateTime date_time)
 Constructor. More...
 
 DateTimeOffset (int64_t ticks, TimeSpan offset)
 Constructor. More...
 
 DateTimeOffset (DateTime date_time, TimeSpan offset)
 Constructor. More...
 
 DateTimeOffset (int year, int month, int day, int hour, int minute, int second, TimeSpan offset)
 Constructor. More...
 
 DateTimeOffset (int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset)
 Constructor. More...
 
 DateTimeOffset (int year, int month, int day, int hour, int minute, int second, int millisecond, const SharedPtr< Globalization::Calendar > &calendar, TimeSpan offset)
 Constructor. More...
 
DateTime get_DateTime () const
 Gets DateTime value. More...
 
DateTime get_UtcDateTime () const
 Gets DateTime value that represents the UTC date and time. More...
 
DateTime get_LocalDateTime () const
 Gets DateTime value that represents the local date and time. More...
 
DateTime get_Date () const
 Gets date component of the current object. More...
 
int get_Year () const
 Gets year component of the current object. More...
 
int get_Month () const
 Gets month component of the current object. More...
 
int get_Day () const
 Gets day of the month of the current object. More...
 
DayOfWeek get_DayOfWeek () const
 Gets day of the week of the current object. More...
 
int get_DayOfYear () const
 Gets day of year of the current object. More...
 
int get_Hour () const
 Gets hour component of the current object. More...
 
int get_Minute () const
 Gets minute component of the current object. More...
 
constexpr int get_Second () const
 Gets second component of the current object. More...
 
constexpr int get_Millisecond () const
 Gets millisecond component of the current object. More...
 
constexpr TimeSpan get_Offset () const
 Gets offset from UTC. More...
 
int64_t get_Ticks () const
 Gets number of ticks of the current object. More...
 
int64_t get_UtcTicks () const
 Gets number of ticks of the current object in UTC time. More...
 
TimeSpan get_TimeOfDay () const
 Gets time of day of the current object. More...
 
DateTimeOffset Add (TimeSpan value) const
 Adds a specified time interval to the DateTimeOffset object. More...
 
DateTimeOffset AddYears (int years) const
 Adds a specified number of years to the DateTimeOffset object. More...
 
DateTimeOffset AddMonths (int months) const
 Adds a specified number of months to the DateTimeOffset object. More...
 
DateTimeOffset AddDays (double days) const
 Adds a specified number of days to the DateTimeOffset object. More...
 
DateTimeOffset AddHours (double hours) const
 Adds a specified number of hours to the DateTimeOffset object. More...
 
DateTimeOffset AddMinutes (double minutes) const
 Adds a specified number of minutes to the DateTimeOffset object. More...
 
DateTimeOffset AddSeconds (double seconds) const
 Adds a specified number of seconds to the DateTimeOffset object. More...
 
DateTimeOffset AddMilliseconds (double milliseconds) const
 Adds a specified number of milliseconds to the DateTimeOffset object. More...
 
DateTimeOffset AddTicks (int64_t ticks) const
 Adds a specified number of ticks to the DateTimeOffset object. More...
 
int CompareTo (const DateTimeOffset &other) const
 Compares two DateTimeOffset objects. More...
 
int CompareTo (const SharedPtr< Object > &obj) const
 Compares two DateTimeOffset objects. More...
 
bool Equals (const DateTimeOffset &other) const
 Checks if two DateTimeOffset objects represents the same time point. More...
 
bool Equals (const SharedPtr< Object > &obj) const
 Checks if two DateTimeOffset objects represents the same time point. More...
 
bool EqualsExact (const DateTimeOffset &other) const
 Checks if two DateTimeOffset objects represents the same time point and has the same offset. More...
 
bool EqualsExact (const SharedPtr< Object > &obj) const
 Checks if two DateTimeOffset objects represents the same time point and has the same offset. More...
 
DateTimeOffset Subtract (TimeSpan value) const
 Subtracts a specified time interval from the current object. More...
 
TimeSpan Subtract (const DateTimeOffset &value) const
 Subtracts a specified DateTimeOffset value from the current object. More...
 
int64_t ToFileTime () const
 Converts current object to the Windows file time. More...
 
DateTimeOffset ToLocalTime () const
 Converts current object to a object that represents the local time,. More...
 
DateTimeOffset ToOffset (TimeSpan offset) const
 Replace current object offset by the specified offset. More...
 
String ToString (const String &format, const SharedPtr< IFormatProvider > &provider) const
 Converts current object to string using the specified format and format provider. More...
 
String ToString (const SharedPtr< IFormatProvider > &provider) const
 Converts current object to string using the specified format provider. More...
 
String ToString (const String &format) const
 Converts current object to string using the specified format. More...
 
DateTimeOffset ToUniversalTime () const
 Converts current object to a object that represents the UTC time,. More...
 
int64_t ToUnixTimeMilliseconds () const
 Gets milliseconds elapsed from Unix epoch start. More...
 
int64_t ToUnixTimeSeconds () const
 Gets seconds elapsed from Unix epoch start. More...
 
int GetHashCode () const
 Gets hash code for the current DateTimeOffset object. More...
 
String ToString () const
 Converts current object to string. More...
 
DateTimeOffset operator+ (TimeSpan value) const
 Returns 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. More...
 
DateTimeOffset operator- (TimeSpan value) const
 Returns 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. More...
 
TimeSpan operator- (const DateTimeOffset &other) const
 Returns an instance of TimeSpan class that represents the time interval between the date and time values represented by the current and the specified objects. More...
 
bool operator== (const DateTimeOffset &other) const
 Determines if the current object and the specified DateTimeOffset object represent the same date and time value. More...
 
bool operator!= (const DateTimeOffset &other) const
 Determines if the current object and the specified DateTimeOffset object represent distinct date and time values. More...
 
bool operator< (const DateTimeOffset &other) const
 Determines if the current object represents the date and time value that is earlier than the value represented by the specified DateTimeOffset object. More...
 
bool operator> (const DateTimeOffset &other) const
 Determines if the current object represents the date and time value that is later than the value represented by the specified DateTimeOffset object. More...
 
bool operator<= (const DateTimeOffset &other) const
 Determines 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. More...
 
bool operator>= (const DateTimeOffset &other) const
 Determines 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. More...
 
constexpr bool IsNull () const
 
constexpr bool operator== (std::nullptr_t) const
 
constexpr bool operator!= (std::nullptr_t) const
 
constexpr bool operator< (std::nullptr_t) const
 
constexpr bool operator<= (std::nullptr_t) const
 
constexpr bool operator> (std::nullptr_t) const
 
constexpr bool operator>= (std::nullptr_t) const
 

Static Public Member Functions

static DateTimeOffset get_UtcNow ()
 Gets DateTimeOffset whose date and time are set to the current UTC-time and whose offset is TimeSpan::Zero. More...
 
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. More...
 
static int Compare (const DateTimeOffset &first, const DateTimeOffset &second)
 Compares two DateTimeOffset objects. More...
 
static bool Equals (const DateTimeOffset &first, const DateTimeOffset &second)
 Checks if two DateTimeOffset objects represent the same time point. More...
 
static DateTimeOffset FromFileTime (int64_t file_time)
 Convert Windows file time to date and time with local time offset. More...
 
static DateTimeOffset FromUnixTimeMilliseconds (int64_t milliseconds)
 Convert Unix-time to DateTimeOffset object. More...
 
static DateTimeOffset FromUnixTimeSeconds (int64_t seconds)
 Convert Unix-time to DateTimeOffset object. More...
 
static DateTimeOffset Parse (const String &input)
 Converts the specified string to DateTimeOffset equivalent. More...
 
static DateTimeOffset Parse (const String &input, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 Converts the specified string to DateTimeOffset object using the specified format provider and formatting style. More...
 
static DateTimeOffset ParseExact (const String &input, const String &format, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 Converts the specified string to DateTimeOffset object using the specified format, format provider and formatting style. More...
 
static DateTimeOffset ParseExact (const String &input, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles)
 Converts the specified string to DateTimeOffset object using the specified formats, format provider and formatting style. More...
 
static bool TryParse (const String &input, DateTimeOffset &result)
 Tries to converts the specified string to DateTimeOffset object. More...
 
static bool TryParse (const String &input, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles, DateTimeOffset &result)
 Tries to converts the specified string to DateTimeOffset object using the specified format provider and formatting style. More...
 
static bool TryParseExact (const String &input, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles, DateTimeOffset &result)
 Tries to converts the specified string to DateTimeOffset object using the specified formats, format provider and formatting style. More...
 
static bool TryParseExact (const String &input, const String &format, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles, DateTimeOffset &result)
 Tries to converts the specified string to DateTimeOffset object using the specified format, format provider and formatting style. More...
 
static const TypeInfoType ()
 Returns a TypeInfo object that represent TimeSpan structure. More...
 

Static Public Attributes

static constexpr int64_t MaxOffset = TimeSpan::TicksPerHour * 14
 Gets maximum offset in ticks. More...
 
static constexpr int64_t MinOffset = -MaxOffset
 Gets minimum offset in ticks. More...
 
static const DateTimeOffset MinValue
 Gets earliest DateTimeOffset value. More...
 
static const DateTimeOffset MaxValue
 Gets greatest DateTimeOffset value. More...
 
static const DateTimeOffset UnixEpoch
 Gets Unix epoch start. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DateTimeOffset() [1/7]

constexpr System::DateTimeOffset::DateTimeOffset ( )
constexprdefault

Default constructor.

◆ DateTimeOffset() [2/7]

System::DateTimeOffset::DateTimeOffset ( DateTime  date_time)

Constructor.

Parameters
date_timeDate and time.

◆ DateTimeOffset() [3/7]

System::DateTimeOffset::DateTimeOffset ( int64_t  ticks,
TimeSpan  offset 
)

Constructor.

Parameters
ticksNumber of ticks.
offsetTime offset from UTC.

◆ DateTimeOffset() [4/7]

System::DateTimeOffset::DateTimeOffset ( DateTime  date_time,
TimeSpan  offset 
)

Constructor.

Parameters
date_timeDate and time.
offsetTime offset from UTC.

◆ DateTimeOffset() [5/7]

System::DateTimeOffset::DateTimeOffset ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
TimeSpan  offset 
)

Constructor.

Parameters
yearYear (1 through 9999).
monthMonth (1 through 12).
dayDay (1 through the number of days in month).
hourHour (0 through 23).
minuteMinute (0 through 59).
secondSecond (0 through 59).
offsetTime offset from UTC.

◆ DateTimeOffset() [6/7]

System::DateTimeOffset::DateTimeOffset ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond,
TimeSpan  offset 
)

Constructor.

Parameters
yearYear (1 through 9999).
monthMonth (1 through 12).
dayDay (1 through the number of days in month).
hourHour (0 through 23).
minuteMinute (0 through 59).
secondSecond (0 through 59).
millisecondMillisecond (0 through 999).
offsetTime offset from UTC.

◆ DateTimeOffset() [7/7]

System::DateTimeOffset::DateTimeOffset ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond,
const SharedPtr< Globalization::Calendar > &  calendar,
TimeSpan  offset 
)

Constructor.

Parameters
yearYear.
monthMonth (1 through 12).
dayDay (1 through the number of days in month).
hourHour (0 through 23).
minuteMinute (0 through 59).
secondSecond (0 through 59).
millisecondMillisecond (0 through 999).
calendarCalendar used to interpret year, month, and day.
offsetTime offset from UTC.

Member Function Documentation

◆ Add()

DateTimeOffset System::DateTimeOffset::Add ( TimeSpan  value) const

Adds a specified time interval to the DateTimeOffset object.

Parameters
valuePositive or a negative time interval.
Returns
Result of operation.

◆ AddDays()

DateTimeOffset System::DateTimeOffset::AddDays ( double  days) const

Adds a specified number of days to the DateTimeOffset object.

Parameters
daysPositive or negative number of days.
Returns
Result of operation.

◆ AddHours()

DateTimeOffset System::DateTimeOffset::AddHours ( double  hours) const

Adds a specified number of hours to the DateTimeOffset object.

Parameters
hoursPositive or negative number of hours.
Returns
Result of operation.

◆ AddMilliseconds()

DateTimeOffset System::DateTimeOffset::AddMilliseconds ( double  milliseconds) const

Adds a specified number of milliseconds to the DateTimeOffset object.

Parameters
millisecondsPositive or negative number of milliseconds.
Returns
Result of operation.

◆ AddMinutes()

DateTimeOffset System::DateTimeOffset::AddMinutes ( double  minutes) const

Adds a specified number of minutes to the DateTimeOffset object.

Parameters
minutesPositive or negative number of minutes.
Returns
Result of operation.

◆ AddMonths()

DateTimeOffset System::DateTimeOffset::AddMonths ( int  months) const

Adds a specified number of months to the DateTimeOffset object.

Parameters
monthsPositive or negative number of months.
Returns
Result of operation.

◆ AddSeconds()

DateTimeOffset System::DateTimeOffset::AddSeconds ( double  seconds) const

Adds a specified number of seconds to the DateTimeOffset object.

Parameters
secondsPositive or negative number of seconds.
Returns
Result of operation.

◆ AddTicks()

DateTimeOffset System::DateTimeOffset::AddTicks ( int64_t  ticks) const

Adds a specified number of ticks to the DateTimeOffset object.

Parameters
ticksPositive or negative number of ticks.
Returns
Result of operation.

◆ AddYears()

DateTimeOffset System::DateTimeOffset::AddYears ( int  years) const

Adds a specified number of years to the DateTimeOffset object.

Parameters
yearsPositive or negative number of years.
Returns
Result of operation.

◆ Compare()

static int System::DateTimeOffset::Compare ( const DateTimeOffset first,
const DateTimeOffset second 
)
static

Compares two DateTimeOffset objects.

Parameters
firstFirst object to compare.
secondSecond object to compare.
Returns
-1 - if first is earlier than second, 1 - if first is later than second, 0 - if first is equal to second.

◆ CompareTo() [1/2]

int System::DateTimeOffset::CompareTo ( const DateTimeOffset other) const

Compares two DateTimeOffset objects.

Parameters
otherObject to compare.
Returns
-1 - if current object is earlier than other, 1 - if current object is later than other, 0 - if current object is equal to other.

◆ CompareTo() [2/2]

int System::DateTimeOffset::CompareTo ( const SharedPtr< Object > &  obj) const

Compares two DateTimeOffset objects.

Parameters
objObject to compare.
Returns
-1 - if current object is earlier than obj, 1 - if current object is later than obj, 0 - if current object is equal to obj.

◆ Equals() [1/3]

static bool System::DateTimeOffset::Equals ( const DateTimeOffset first,
const DateTimeOffset second 
)
static

Checks if two DateTimeOffset objects represent the same time point.

Parameters
firstFirst object to compare.
secondSecond object to compare.
Returns
true if first is equal to second, otherwise - false.

◆ Equals() [2/3]

bool System::DateTimeOffset::Equals ( const DateTimeOffset other) const

Checks if two DateTimeOffset objects represents the same time point.

Parameters
otherObject to compare.
Returns
true if current object is equal to other, otherwise - false.

◆ Equals() [3/3]

bool System::DateTimeOffset::Equals ( const SharedPtr< Object > &  obj) const

Checks if two DateTimeOffset objects represents the same time point.

Parameters
objObject to compare.
Returns
true if current object is equal to obj, otherwise - false.

◆ EqualsExact() [1/2]

bool System::DateTimeOffset::EqualsExact ( const DateTimeOffset other) const

Checks if two DateTimeOffset objects represents the same time point and has the same offset.

Parameters
otherObject to compare.
Returns
true if current object is exact equal to other, otherwise - false.

◆ EqualsExact() [2/2]

bool System::DateTimeOffset::EqualsExact ( const SharedPtr< Object > &  obj) const

Checks if two DateTimeOffset objects represents the same time point and has the same offset.

Parameters
objObject to compare.
Returns
true if current object is exact equal to obj, otherwise - false.

◆ FromFileTime()

static DateTimeOffset System::DateTimeOffset::FromFileTime ( int64_t  file_time)
static

Convert Windows file time to date and time with local time offset.

Parameters
file_timeWindows file time.
Returns
Date and time with local time offset.

◆ FromUnixTimeMilliseconds()

static DateTimeOffset System::DateTimeOffset::FromUnixTimeMilliseconds ( int64_t  milliseconds)
static

Convert Unix-time to DateTimeOffset object.

Parameters
millisecondsUnix-time (number of milliseconds elapsed from 1970-01-01).
Returns
Date and time with zero offset.

◆ FromUnixTimeSeconds()

static DateTimeOffset System::DateTimeOffset::FromUnixTimeSeconds ( int64_t  seconds)
static

Convert Unix-time to DateTimeOffset object.

Parameters
secondsUnix-time (number of seconds elapsed from 1970-01-01).
Returns
Date and time with zero offset.

◆ get_Date()

DateTime System::DateTimeOffset::get_Date ( ) const

Gets date component of the current object.

◆ get_DateTime()

DateTime System::DateTimeOffset::get_DateTime ( ) const

Gets DateTime value.

◆ get_Day()

int System::DateTimeOffset::get_Day ( ) const

Gets day of the month of the current object.

◆ get_DayOfWeek()

DayOfWeek System::DateTimeOffset::get_DayOfWeek ( ) const

Gets day of the week of the current object.

◆ get_DayOfYear()

int System::DateTimeOffset::get_DayOfYear ( ) const

Gets day of year of the current object.

◆ get_Hour()

int System::DateTimeOffset::get_Hour ( ) const

Gets hour component of the current object.

◆ get_LocalDateTime()

DateTime System::DateTimeOffset::get_LocalDateTime ( ) const

Gets DateTime value that represents the local date and time.

◆ get_Millisecond()

constexpr int System::DateTimeOffset::get_Millisecond ( ) const
inlineconstexpr

Gets millisecond component of the current object.

◆ get_Minute()

int System::DateTimeOffset::get_Minute ( ) const

Gets minute component of the current object.

◆ get_Month()

int System::DateTimeOffset::get_Month ( ) const

Gets month component of the current object.

◆ get_Now()

static DateTimeOffset System::DateTimeOffset::get_Now ( )
static

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()

constexpr TimeSpan System::DateTimeOffset::get_Offset ( ) const
inlineconstexpr

Gets offset from UTC.

◆ get_Second()

constexpr int System::DateTimeOffset::get_Second ( ) const
inlineconstexpr

Gets second component of the current object.

◆ get_Ticks()

int64_t System::DateTimeOffset::get_Ticks ( ) const

Gets number of ticks of the current object.

◆ get_TimeOfDay()

TimeSpan System::DateTimeOffset::get_TimeOfDay ( ) const

Gets time of day of the current object.

◆ get_UtcDateTime()

DateTime System::DateTimeOffset::get_UtcDateTime ( ) const

Gets DateTime value that represents the UTC date and time.

◆ get_UtcNow()

static DateTimeOffset System::DateTimeOffset::get_UtcNow ( )
static

Gets DateTimeOffset whose date and time are set to the current UTC-time and whose offset is TimeSpan::Zero.

◆ get_UtcTicks()

int64_t System::DateTimeOffset::get_UtcTicks ( ) const

Gets number of ticks of the current object in UTC time.

◆ get_Year()

int System::DateTimeOffset::get_Year ( ) const

Gets year component of the current object.

◆ GetHashCode()

int System::DateTimeOffset::GetHashCode ( ) const

Gets hash code for the current DateTimeOffset object.

Returns
A 32-bit signed integer hash code.

◆ IsNull()

constexpr bool System::DateTimeOffset::IsNull ( ) const
inlineconstexpr

◆ operator!=() [1/2]

bool System::DateTimeOffset::operator!= ( const DateTimeOffset other) const

Determines if the current object and the specified DateTimeOffset object represent distinct date and time values.

Parameters
otherThe DateTimeOffset object to compare the current object with
Returns
True if the current object and the specified object represent distinct date and time values, otherwise - false

◆ operator!=() [2/2]

constexpr bool System::DateTimeOffset::operator!= ( std::nullptr_t  ) const
inlineconstexpr

◆ operator+()

DateTimeOffset System::DateTimeOffset::operator+ ( TimeSpan  value) const

Returns 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.

Parameters
valueThe time span to add to the value represented by the current object
Returns
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 value.

◆ operator-() [1/2]

TimeSpan System::DateTimeOffset::operator- ( const DateTimeOffset other) const

Returns an instance of TimeSpan class that represents the time interval between the date and time values represented by the current and the specified objects.

Parameters
otherAn instance of DateTime class that marks one end of the interval to be calculated
Returns
An instance of TimeSpan class representing the time interval between the date and time values represented by the current object and other.

◆ operator-() [2/2]

DateTimeOffset System::DateTimeOffset::operator- ( TimeSpan  value) const

Returns 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.

Parameters
valueA time interval to subtract
Returns
A new instance of the DateTimeOffset class representing the date and time value which is the result of subtraction of value from the value represented by the current object.

◆ operator<() [1/2]

bool System::DateTimeOffset::operator< ( const DateTimeOffset other) const

Determines if the current object represents the date and time value that is earlier than the value represented by the specified DateTimeOffset object.

Parameters
otherThe DateTimeOffset object to compare the current object with
Returns
True if the date and time value represented by the current object is earlier than the value represented by other, otherwise - false

◆ operator<() [2/2]

constexpr bool System::DateTimeOffset::operator< ( std::nullptr_t  ) const
inlineconstexpr

◆ operator<=() [1/2]

bool System::DateTimeOffset::operator<= ( const DateTimeOffset other) const

Determines 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.

Parameters
otherThe DateTimeOffset object to compare the current object with
Returns
True if the date and time value represented by the current object is earlier than or the same as the value represented by other, otherwise - false

◆ operator<=() [2/2]

constexpr bool System::DateTimeOffset::operator<= ( std::nullptr_t  ) const
inlineconstexpr

◆ operator==() [1/2]

bool System::DateTimeOffset::operator== ( const DateTimeOffset other) const

Determines if the current object and the specified DateTimeOffset object represent the same date and time value.

Parameters
otherThe DateTimeOffset object to compare the current object with
Returns
True if the current object and the specified object represent the same date and time value, otherwise - false

◆ operator==() [2/2]

constexpr bool System::DateTimeOffset::operator== ( std::nullptr_t  ) const
inlineconstexpr

◆ operator>() [1/2]

bool System::DateTimeOffset::operator> ( const DateTimeOffset other) const

Determines if the current object represents the date and time value that is later than the value represented by the specified DateTimeOffset object.

Parameters
otherThe DateTimeOffset object to compare the current object with
Returns
True if the date and time value represented by the current object is later than the value represented by other, otherwise - false

◆ operator>() [2/2]

constexpr bool System::DateTimeOffset::operator> ( std::nullptr_t  ) const
inlineconstexpr

◆ operator>=() [1/2]

bool System::DateTimeOffset::operator>= ( const DateTimeOffset other) const

Determines 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.

Parameters
otherThe DateTimeOffset object to compare the current object with
Returns
True if the date and time value represented by the current object is later than or the same as the value represented by other, otherwise - false

◆ operator>=() [2/2]

constexpr bool System::DateTimeOffset::operator>= ( std::nullptr_t  ) const
inlineconstexpr

◆ Parse() [1/2]

static DateTimeOffset System::DateTimeOffset::Parse ( const String input)
static

Converts the specified string to DateTimeOffset equivalent.

Parameters
inputString to convert.
Returns
DateTimeOffset that is equivalent to the input.

◆ Parse() [2/2]

static DateTimeOffset System::DateTimeOffset::Parse ( const String input,
const SharedPtr< IFormatProvider > &  provider,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

Converts the specified string to DateTimeOffset object using the specified format provider and formatting style.

Parameters
inputString to convert.
providerFormat provider.
stylesDate and time formatting styles.
Returns
DateTimeOffset that is equivalent to the input.

◆ ParseExact() [1/2]

static DateTimeOffset System::DateTimeOffset::ParseExact ( const String input,
const ArrayPtr< String > &  formats,
const SharedPtr< IFormatProvider > &  provider,
Globalization::DateTimeStyles  styles 
)
static

Converts the specified string to DateTimeOffset object using the specified formats, format provider and formatting style.

Parameters
inputString to convert.
formatsArray of format strings.
providerFormat provider.
stylesDate and time formatting styles.
Returns
DateTimeOffset that is equivalent to the input.

◆ ParseExact() [2/2]

static DateTimeOffset System::DateTimeOffset::ParseExact ( const String input,
const String format,
const SharedPtr< IFormatProvider > &  provider,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

Converts the specified string to DateTimeOffset object using the specified format, format provider and formatting style.

Parameters
inputString to convert.
formatFormat string.
providerFormat provider.
stylesDate and time formatting styles.
Returns
DateTimeOffset that is equivalent to the input.

◆ Subtract() [1/2]

TimeSpan System::DateTimeOffset::Subtract ( const DateTimeOffset value) const

Subtracts a specified DateTimeOffset value from the current object.

Parameters
valueValue to subtract.
Returns
Result of operation.

◆ Subtract() [2/2]

DateTimeOffset System::DateTimeOffset::Subtract ( TimeSpan  value) const

Subtracts a specified time interval from the current object.

Parameters
valueValue to subtract.
Returns
Result of operation.

◆ ToFileTime()

int64_t System::DateTimeOffset::ToFileTime ( ) const

Converts current object to the Windows file time.

Returns
Current DateTimeOffset object expressed as windows file time.

◆ ToLocalTime()

DateTimeOffset System::DateTimeOffset::ToLocalTime ( ) const

Converts current object to a object that represents the local time,.

Returns
Current DateTimeOffset object converted to local time.

◆ ToOffset()

DateTimeOffset System::DateTimeOffset::ToOffset ( TimeSpan  offset) const

Replace current object offset by the specified offset.

Parameters
offsetUTC-offset.
Returns
Current DateTimeOffset object converted to the date and time with specified offset.

◆ ToString() [1/4]

String System::DateTimeOffset::ToString ( ) const

Converts current object to string.

Returns
String representation of the current DateTimeOffset object.

◆ ToString() [2/4]

String System::DateTimeOffset::ToString ( const SharedPtr< IFormatProvider > &  provider) const

Converts current object to string using the specified format provider.

Parameters
providerFormat provider.
Returns
String representation of the current DateTimeOffset object.

◆ ToString() [3/4]

String System::DateTimeOffset::ToString ( const String format) const

Converts current object to string using the specified format.

Parameters
formatFormat string.
Returns
String representation of the current DateTimeOffset object.

◆ ToString() [4/4]

String System::DateTimeOffset::ToString ( const String format,
const SharedPtr< IFormatProvider > &  provider 
) const

Converts current object to string using the specified format and format provider.

Parameters
formatFormat string.
providerFormat provider.
Returns
String representation of the current DateTimeOffset object.

◆ ToUniversalTime()

DateTimeOffset System::DateTimeOffset::ToUniversalTime ( ) const

Converts current object to a object that represents the UTC time,.

Returns
Current DateTimeOffset object converted to UTC-time.

◆ ToUnixTimeMilliseconds()

int64_t System::DateTimeOffset::ToUnixTimeMilliseconds ( ) const

Gets milliseconds elapsed from Unix epoch start.

Returns
Number of milliseconds elapsed since 1970-01-01.

◆ ToUnixTimeSeconds()

int64_t System::DateTimeOffset::ToUnixTimeSeconds ( ) const

Gets seconds elapsed from Unix epoch start.

Returns
Number of seconds elapsed since 1970-01-01.

◆ TryParse() [1/2]

static bool System::DateTimeOffset::TryParse ( const String input,
const SharedPtr< IFormatProvider > &  provider,
Globalization::DateTimeStyles  styles,
DateTimeOffset result 
)
static

Tries to converts the specified string to DateTimeOffset object using the specified format provider and formatting style.

Parameters
inputString to convert.
providerFormat provider.
stylesDate and time formatting styles.
resultDateTimeOffset that is equivalent to the input.
Returns
true if the input converted successfully, otherwise - false.

◆ TryParse() [2/2]

static bool System::DateTimeOffset::TryParse ( const String input,
DateTimeOffset result 
)
static

Tries to converts the specified string to DateTimeOffset object.

Parameters
inputString to convert.
resultDateTimeOffset that is equivalent to the input.
Returns
true if the input converted successfully, otherwise - false.

◆ TryParseExact() [1/2]

static bool System::DateTimeOffset::TryParseExact ( const String input,
const ArrayPtr< String > &  formats,
const SharedPtr< IFormatProvider > &  provider,
Globalization::DateTimeStyles  styles,
DateTimeOffset result 
)
static

Tries to converts the specified string to DateTimeOffset object using the specified formats, format provider and formatting style.

Parameters
inputString to convert.
formatsArrays of format strings.
providerFormat provider.
stylesDate and time formatting styles.
resultDateTimeOffset that is equivalent to the input.
Returns
true if the input converted successfully, otherwise - false.

◆ TryParseExact() [2/2]

static bool System::DateTimeOffset::TryParseExact ( const String input,
const String format,
const SharedPtr< IFormatProvider > &  provider,
Globalization::DateTimeStyles  styles,
DateTimeOffset result 
)
static

Tries to converts the specified string to DateTimeOffset object using the specified format, format provider and formatting style.

Parameters
inputString to convert.
formatFormat string.
providerFormat provider.
stylesDate and time formatting styles.
resultDateTimeOffset that is equivalent to the input.
Returns
true if the input converted successfully, otherwise - false.

◆ Type()

static const TypeInfo & System::DateTimeOffset::Type ( )
inlinestatic

Returns a TypeInfo object that represent TimeSpan structure.

Member Data Documentation

◆ MaxOffset

constexpr int64_t System::DateTimeOffset::MaxOffset = TimeSpan::TicksPerHour * 14
staticconstexpr

Gets maximum offset in ticks.

◆ MaxValue

const DateTimeOffset System::DateTimeOffset::MaxValue
static

Gets greatest DateTimeOffset value.

◆ MinOffset

constexpr int64_t System::DateTimeOffset::MinOffset = -MaxOffset
staticconstexpr

Gets minimum offset in ticks.

◆ MinValue

const DateTimeOffset System::DateTimeOffset::MinValue
static

Gets earliest DateTimeOffset value.

◆ UnixEpoch

const DateTimeOffset System::DateTimeOffset::UnixEpoch
static

Gets Unix epoch start.