Represents a specific date and time value on the time continuum. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type. More...

Public Member Functions

constexpr DateTime ()
 Constructs an instance that represents the smallest possible date and time value equal to MinValue. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day)
 Constructs an instance that represents a date and time value specified as a particular year, month and day. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day, const SharedPtr< Globalization::Calendar > &calendar)
 Constructs an instance that represents a date and time value specified as a particular year, month and day in the specified calendar. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day, int hour, int minute, int second)
 Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute and second. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day, int hour, int minute, int second, DateTimeKind kind)
 Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute and second. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day, int hour, int minute, int second, const SharedPtr< Globalization::Calendar > &calendar)
 Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute and second in the specified calendar. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind=DateTimeKind::Unspecified)
 Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute, second and millisecond. More...
 
ASPOSECPP_SHARED_API DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, const SharedPtr< Globalization::Calendar > &calendar, DateTimeKind kind=DateTimeKind::Unspecified)
 Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute, second and millisecond in the specified calendar. More...
 
ASPOSECPP_SHARED_API DateTime (int64_t ticks, DateTimeKind kind=DateTimeKind::Unspecified)
 Construct an instance that represents a date and time value specified as a number of ticks. More...
 
 DateTime (int64_t ticks, DateTimeKind kind, bool is_ambiguous_local_dst)
 Construct an instance that represents a date and time value specified as a number of ticks. FOR INTERNAL USE. More...
 
 DateTime (const DateTime &dt)=default
 Copy-constructs an instance. More...
 
DateTimeoperator= (const DateTime &dt)=default
 Assigns the value represented by the specified DateTime instance to the current object. More...
 
constexpr DateTime get_Date () const
 Returns a new instance of DateTime class that represents the date portion of the date and time represented by the current object with each component of the time portion set to 0. More...
 
constexpr DayOfWeek get_DayOfWeek () const
 Returns a value representing a day of week that is represented by the current object. More...
 
constexpr DateTimeKind get_Kind () const
 Returns the value representing if the date and time represented by the current object is a local or UTC date and time or neither. More...
 
constexpr TimeSpan get_TimeOfDay () const
 Returns the value that represents the time interval from the beginning of the day represented by the current object till the date and time value represented by the current object. More...
 
ASPOSECPP_SHARED_API int get_DayOfYear () const
 Returns the ordinal number of the day in the year represented by the current object. More...
 
ASPOSECPP_SHARED_API int get_Year () const
 Returns the year represented by the current object. More...
 
ASPOSECPP_SHARED_API int get_Month () const
 Returns the ordinal number of the month in the year represented by the current object. More...
 
ASPOSECPP_SHARED_API int get_Day () const
 Returns the ordinal number of the day in the month represented by the current object. More...
 
void GetDateComponents (int &year, int &month, int &day) const
 Gets date parts. FOR INTERNAL USE. More...
 
constexpr int get_Hour () const
 Returns the hour component of the date and time value represented by the current object. More...
 
constexpr int get_Minute () const
 Returns the minute component of the date and time value represented by the current object. More...
 
constexpr int get_Second () const
 Returns the second component of the date and time value represented by the current object. More...
 
constexpr int get_Millisecond () const
 Returns the millisecond component of the date and time value represented by the current object. More...
 
constexpr int64_t get_Ticks () const
 Returns a number of 100-nanosecond intervals passed since 0:00:00 UTC, January 1, 0001, in the Gregorian calendar until the date and time represented by the current object. More...
 
ASPOSECPP_SHARED_API DateTime Add (TimeSpan value) const
 Returns a new instance of DateTime class that represents a date and time value that results from addition of the specified time span to the date and time value represented by the current object. More...
 
ASPOSECPP_SHARED_API DateTime AddYears (int value) const
 Returns a new instance of the DateTime class representing the date and time value equal to that represented by the current object with the year component increased by the specified number. More...
 
ASPOSECPP_SHARED_API DateTime AddMonths (int value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of months. More...
 
ASPOSECPP_SHARED_API DateTime AddDays (double value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of days. More...
 
ASPOSECPP_SHARED_API DateTime AddHours (double value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of hours. More...
 
ASPOSECPP_SHARED_API DateTime AddMinutes (double value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of minutes. More...
 
ASPOSECPP_SHARED_API DateTime AddSeconds (double value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of seconds. More...
 
ASPOSECPP_SHARED_API DateTime AddMilliseconds (double value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of milliseconds. More...
 
ASPOSECPP_SHARED_API DateTime AddTicks (int64_t value) const
 Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of 100-nanosecond intervals. More...
 
ASPOSECPP_SHARED_API DateTime Subtract (TimeSpan duration) const
 Returns a new instance of the DateTime 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...
 
constexpr TimeSpan Subtract (DateTime value) const
 Returns an instance of TimeSpan class representing the time interval between the date and time values represented by the current and the specified objects. More...
 
ASPOSECPP_SHARED_API DateTime ToLocalTime () const
 Returns a new instance of DateTime class that represents the date and time value represented by the current object as local time. More...
 
ASPOSECPP_SHARED_API DateTime ToUniversalTime () const
 Returns a new instance of DateTime class that represents the date and time value represented by the current object as UTC. More...
 
time_t ToUnixTime () const
 Returns a value that represents the date and time value represented by the current object as Unix time. FOR INTERNAL USE. More...
 
ASPOSECPP_SHARED_API int64_t ToFileTime () const
 Returns a value that represents the date and time value represented by the current object as File time. More...
 
ASPOSECPP_SHARED_API int64_t ToFileTimeUtc () const
 Converts the date and time value represented by the current object to File time UTC. More...
 
ASPOSECPP_SHARED_API int64_t ToBinary () const
 Serializes the current object. More...
 
ASPOSECPP_SHARED_API double ToOADate () const
 Returns the date and time value represented by the current object as OLE Automation Date. More...
 
ASPOSECPP_SHARED_API bool IsDaylightSavingTime () const
 Determines if the date and time value represented by the current object falls in the range of daylight saving time for the current time zone. More...
 
constexpr int CompareTo (DateTime value) const
 Compares two date and time values represented by the current object and the specified instance of DateTime class and returns the value indicating values' relative positions on the time line. More...
 
constexpr bool Equals (DateTime other) const
 Determines if the specified instance of DateTime class represent the same date and time value as the current object. More...
 
ASPOSECPP_SHARED_API int GetHashCode () const
 Returns a hash code for the current object. More...
 
ASPOSECPP_SHARED_API String ToString () const
 Returns the string representation of the date and time value represented by the current object using the formatting conventions defined by the current culture. More...
 
ASPOSECPP_SHARED_API String ToString (const String &format) const
 Returns a string representation of the date and time value represented by the current object using the specified format and formatting conventions defined by the current culture. More...
 
ASPOSECPP_SHARED_API String ToString (const SharedPtr< IFormatProvider > &provider) const
 Returns a string representation of the date and time value represented by the current object using the specified format information. More...
 
ASPOSECPP_SHARED_API String ToString (const SharedPtr< Globalization::CultureInfo > &culture) const
 
ASPOSECPP_SHARED_API String ToString (const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi) const
 
String ToString (std::nullptr_t) const
 
ASPOSECPP_SHARED_API String ToString (const String &format, const SharedPtr< IFormatProvider > &provider) const
 Returns a string representation of the date and time value represented by the current object using the specified format information. More...
 
ASPOSECPP_SHARED_API String ToString (const String &format, const SharedPtr< Globalization::CultureInfo > &culture) const
 
ASPOSECPP_SHARED_API String ToString (const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi) const
 
String ToString (const String &format, std::nullptr_t) const
 
ASPOSECPP_SHARED_API String ToShortDateString () const
 Returns a string that contains the short date string representation of the current object. More...
 
ASPOSECPP_SHARED_API String ToLongDateString () const
 Returns a string that contains the long date string representation of the current object. More...
 
ASPOSECPP_SHARED_API String ToShortTimeString () const
 Returns a string that contains the short time string representation of the current object. More...
 
ASPOSECPP_SHARED_API String ToLongTimeString () const
 Returns a string that contains the long time string representation of the current object. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringGetDateTimeFormats () const
 Returns array of strings where each element is the string representation of the current object formatted with one of the standard date and time format specifiers. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringGetDateTimeFormats (char_t format) const
 Returns array of strings where each element is the string representation of the current object formatted with the specified standard date and time format specifier. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringGetDateTimeFormats (const SharedPtr< IFormatProvider > &provider) const
 Returns array of strings where each element is the string representation of the current object formatted with one of the standard date and time format specifiers and the specified format provider. More...
 
ASPOSECPP_SHARED_API ArrayPtr< StringGetDateTimeFormats (char_t format, const SharedPtr< IFormatProvider > &provider) const
 Returns array of strings where each element is the string representation of the current object formatted with the specified standard date and time format specifier and format provider. More...
 
constexpr bool operator== (DateTime other) const
 Determines if the current object and the specified DateTime object represent the same date and time value. More...
 
constexpr bool operator!= (DateTime other) const
 Determines if the current object and the specified DateTime object represent distinct date and time values. More...
 
constexpr bool operator< (DateTime other) const
 Determines if the current object represents the date and time value that is earlier than the value represented by the specified DateTime object. More...
 
constexpr bool operator<= (DateTime 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 DateTime object. More...
 
constexpr bool operator> (DateTime other) const
 Determines if the current object represents the date and time value that is later than the value represented by the specified DateTime object. More...
 
constexpr bool operator>= (DateTime 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 DateTime object. More...
 
DateTime operator+ (TimeSpan value) const
 Returns a new instance of DateTime 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...
 
DateTime operator- (TimeSpan value) const
 Returns a new instance of the DateTime 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...
 
DateTimeoperator+= (TimeSpan value)
 Sets the current object to the date and time value that is the sum of the value represented by the current object and the specified time span. More...
 
DateTimeoperator-= (TimeSpan value)
 Sets the current object to the date and time value that is the result of subtraction of the specified time span from the date and time value represented by the current object. More...
 
constexpr TimeSpan operator- (DateTime value) 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...
 
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 ASPOSECPP_SHARED_API DateTime get_Now ()
 Returns an instance of DateTime class that represents the current time as local time. More...
 
static ASPOSECPP_SHARED_API DateTime get_UtcNow ()
 Returns an instance of DateTime class that represents the current time as UTC. More...
 
static ASPOSECPP_SHARED_API DateTime get_Today ()
 Returns an instance of DateTime class that represents the current date with each component of time portion of the value represented by the object set to 0. More...
 
static ASPOSECPP_SHARED_API DateTime FromBinary (int64_t value)
 Deserializes the date time value from the specified unsigned 64-bit integer and sets the new instance of DateTime class to that value. More...
 
static ASPOSECPP_SHARED_API DateTime FromFileTimeUtc (int64_t file_time)
 Converts the specified File time to an instance of DateTime class representing the same date and time value as UTC time. More...
 
static ASPOSECPP_SHARED_API DateTime FromOADate (double date)
 Returns an instance of DateTime class representing the date and time value equivalent to the specified OLE Automation Date. More...
 
static DateTime FromUnixTime (time_t value)
 Converts the specified Unix time value to an instance of DateTime class. FOR INTERNAL USE. More...
 
static ASPOSECPP_SHARED_API DateTime FromFileTime (int64_t value)
 Converts the specified File time to an instance of DateTime class representing the same date and time value as local time. More...
 
static ASPOSECPP_SHARED_API int DaysInMonth (int year, int month)
 Returns the number of days in the specified month of the specified year. More...
 
static ASPOSECPP_SHARED_API bool IsLeapYear (int year)
 Determines of the specified year is a leap year. More...
 
static DateTime SpecifyKind (DateTime value, DateTimeKind kind)
 Constructs a new DateTime object that represents the same number of ticks as the specified DateTime object and represents local time, UTC time or neither as specified by the argument kind. More...
 
static constexpr int Compare (DateTime t1, DateTime t2)
 Compares two values represented by the specified instances of DateTime class and returns the value indicating values' relative positions on the time line. More...
 
static constexpr bool Equals (DateTime t1, DateTime t2)
 Determines if the specified instances of DateTime class represent the same date and time value. More...
 
static ASPOSECPP_SHARED_API DateTime Parse (const String &s)
 Converts the specified string representation of a date and time value to the equivalent DateTime object. More...
 
static ASPOSECPP_SHARED_API DateTime Parse (const String &s, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 Converts the specified string representation of a date and time value to the equivalent DateTime object using culture-specific format information. More...
 
static ASPOSECPP_SHARED_API DateTime Parse (const String &s, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 
static ASPOSECPP_SHARED_API DateTime Parse (const String &s, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 
static ASPOSECPP_SHARED_API DateTime Parse (const String &s, std::nullptr_t, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const String &format, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly. Throws an exception if the conversion fails. More...
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const String &format, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const String &format, std::nullptr_t, Globalization::DateTimeStyles styles=Globalization::DateTimeStyles::None)
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles)
 Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified formats, culture-specific format information and style. The format of the string representation must match one or more of the specified formats exactly. Throws an exception if the conversion fails. More...
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const ArrayPtr< String > &formats, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::DateTimeStyles styles)
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const ArrayPtr< String > &formats, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::DateTimeStyles styles)
 
static ASPOSECPP_SHARED_API DateTime ParseExact (const String &s, const ArrayPtr< String > &formats, std::nullptr_t, Globalization::DateTimeStyles styles)
 
static ASPOSECPP_SHARED_API bool TryParse (const String &s, DateTime &result)
 Converts the specified string representation of a date and time value to the equivalent DateTime object. More...
 
static ASPOSECPP_SHARED_API bool TryParse (const String &s, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles, DateTime &result)
 Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified culture-specific format information and style. More...
 
static ASPOSECPP_SHARED_API bool TryParse (const String &s, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParse (const String &s, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParse (const String &s, std::nullptr_t, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const String &format, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles, DateTime &result)
 Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified format, culture-specific format information and style. The format of the string representation must match the specified format exactly. More...
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const String &format, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const String &format, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const String &format, std::nullptr_t, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const ArrayPtr< String > &formats, const SharedPtr< IFormatProvider > &provider, Globalization::DateTimeStyles styles, DateTime &result)
 Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified formats, culture-specific format information and style. The format of the string representation must match one or more of the specified formats exactly. More...
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const ArrayPtr< String > &formats, const SharedPtr< Globalization::CultureInfo > &culture, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const ArrayPtr< String > &formats, const SharedPtr< Globalization::DateTimeFormatInfo > &dtfi, Globalization::DateTimeStyles styles, DateTime &result)
 
static ASPOSECPP_SHARED_API bool TryParseExact (const String &s, const ArrayPtr< String > &formats, std::nullptr_t, Globalization::DateTimeStyles styles, DateTime &result)
 
static const TypeInfoType ()
 Returns a TypeInfo object that contains information about this class. More...
 

Static Public Attributes

static constexpr int64_t TicksPerMicrosecond = 10
 The number of ticks in a microsecond. More...
 
static constexpr int64_t TicksPerMillisecond = 10000
 The number of ticks in a millisecond. More...
 
static constexpr int64_t TicksPerSecond = TicksPerMillisecond * 1000
 The number of ticks in a second. More...
 
static constexpr int64_t TicksPerMinute = TicksPerSecond * 60
 The number of ticks in a minute. More...
 
static constexpr int64_t TicksPerHour = TicksPerMinute * 60
 The number of ticks in a hour. More...
 
static constexpr int64_t TicksPerDay = TicksPerHour * 24
 The number of ticks in a day. More...
 
static constexpr int64_t MinTicks = 0
 The minimal number of ticks that an instance of DateTime class can represent. More...
 
static constexpr int64_t MaxTicks = 3652059 * TicksPerDay - 1
 The number of 100-nanosecond in the time interval between the minimal possible and maximal possible DateTime value. More...
 
static ASPOSECPP_SHARED_API const DateTime MinValue
 An instance of DateTime class that represents the minimal possible date and time value. More...
 
static ASPOSECPP_SHARED_API const DateTime MaxValue
 An instance of DateTime class that represents the maximal possible date and time value. More...
 
static ASPOSECPP_SHARED_API const DateTime UnixEpoch
 An instance of DateTime class that represents the Unix epoch start (1970.01.01 00:00:00). More...
 

Detailed Description

Represents a specific date and time value on the time continuum. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

#include "system/console.h"
#include "system/date_time.h"
int main()
{
using namespace System;
// Create the 'DateTime' class instance.
DateTime dateTime{1990, 10, 30};
// Print the instance in the multiple formats.
Console::WriteLine(dateTime.ToShortDateString());
Console::WriteLine(dateTime.ToShortTimeString());
Console::WriteLine(dateTime.ToString());
return 0;
}
/*
This code example produces the following output:
30.10.1990
0:00
30.10.1990 0:00:00
*/

Constructor & Destructor Documentation

◆ DateTime() [1/11]

constexpr System::DateTime::DateTime ( )
inline

Constructs an instance that represents the smallest possible date and time value equal to MinValue.

◆ DateTime() [2/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day 
)

Constructs an instance that represents a date and time value specified as a particular year, month and day.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.

◆ DateTime() [3/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day,
const SharedPtr< Globalization::Calendar > &  calendar 
)

Constructs an instance that represents a date and time value specified as a particular year, month and day in the specified calendar.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.
calendarThe calendar used to interpret the specified year, month and day.

◆ DateTime() [4/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second 
)

Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute and second.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.
hourThe hour of the day to be represented by the instance being constructed.
minuteThe minute of the hour to be represented by the instance being constructed.
secondThe second of the minute te be represented by the instance being constructed.

◆ DateTime() [5/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
DateTimeKind  kind 
)

Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute and second.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.
hourThe hour of the day to be represented by the instance being constructed.
minuteThe minute of the hour to be represented by the instance being constructed.
secondThe second of the minute te be represented by the instance being constructed.
kindThe value that indicates if the provided date and time parameters specify a local time, UTC time or neither.

◆ DateTime() [6/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
const SharedPtr< Globalization::Calendar > &  calendar 
)

Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute and second in the specified calendar.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.
hourThe hour of the day to be represented by the instance being constructed.
minuteThe minute of the hour to be represented by the instance being constructed.
secondThe second of the minute te be represented by the instance being constructed.
calendarThe calendar used to interpret the specified year, month and day.

◆ DateTime() [7/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond,
DateTimeKind  kind = DateTimeKind::Unspecified 
)

Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute, second and millisecond.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.
hourThe hour of the day to be represented by the instance being constructed.
minuteThe minute of the hour to be represented by the instance being constructed.
secondThe second of the minute te be represented by the instance being constructed.
millisecondThe millisecond of the second to be represented by the instance being constructed.
kindThe value that indicates if the provided date and time parameters specify a local time, UTC time or neither.

◆ DateTime() [8/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond,
const SharedPtr< Globalization::Calendar > &  calendar,
DateTimeKind  kind = DateTimeKind::Unspecified 
)

Constructs an instance that represents a date and time value specified as a particular year, month, day, hour, minute, second and millisecond in the specified calendar.

Parameters
yearThe year to be represented by the instance being constructed.
monthThe month of the year to be represented by the instance being constructed.
dayThe day of the month to be represented by the instance being constructed.
hourThe hour of the day to be represented by the instance being constructed.
minuteThe minute of the hour to be represented by the instance being constructed.
secondThe second of the minute te be represented by the instance being constructed.
millisecondThe millisecond of the second to be represented by the instance being constructed.
kindThe value that indicates if the provided date and time parameters specify a local time, UTC time or neither.
calendarThe calendar used to interpret the specified year, month and day.

◆ DateTime() [9/11]

ASPOSECPP_SHARED_API System::DateTime::DateTime ( int64_t  ticks,
DateTimeKind  kind = DateTimeKind::Unspecified 
)

Construct an instance that represents a date and time value specified as a number of ticks.

Parameters
ticksThe number of 100-ns intervals that have passed since January the 1st, 0001 00:00:00.000 in Georgian calendar.
kindThe value that indicates if ticks parameter specifies a local time, UTC time or neither.

◆ DateTime() [10/11]

System::DateTime::DateTime ( int64_t  ticks,
DateTimeKind  kind,
bool  is_ambiguous_local_dst 
)

Construct an instance that represents a date and time value specified as a number of ticks. FOR INTERNAL USE.

Parameters
ticksThe number of 100-ns intervals that have passed since January the 1st, 0001 00:00:00.000 in Georgian calendar.
kindThe value that indicates if ticks parameter specifies a local time, UTC time or neither.
is_ambiguous_local_dstTrue if specified date and time is ambiguous and can be mapped to many UTC times.

◆ DateTime() [11/11]

System::DateTime::DateTime ( const DateTime dt)
default

Copy-constructs an instance.

Parameters
dtAn instance of DateTime class to copy the represented date and time value from

Member Function Documentation

◆ Add()

ASPOSECPP_SHARED_API DateTime System::DateTime::Add ( TimeSpan  value) const

Returns a new instance of DateTime class that represents a date and time value that results from addition of the specified time span to the date and time value represented by the current object.

Parameters
valueThe time interval to add
Returns
A new instance of DateTime class that represents a date and time value that results from addition of tm time span to the date and time value represented by the current object

◆ AddDays()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddDays ( double  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of days.

Parameters
valueThe number of days to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value days

◆ AddHours()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddHours ( double  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of hours.

Parameters
valueThe number of hours to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value hours

◆ AddMilliseconds()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddMilliseconds ( double  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of milliseconds.

Parameters
valueThe number of milliseconds to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value milliseconds

◆ AddMinutes()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddMinutes ( double  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of minutes.

Parameters
valueThe number of minutes to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value minutes

◆ AddMonths()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddMonths ( int  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of months.

Parameters
valueThe number of months to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value months

◆ AddSeconds()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddSeconds ( double  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of seconds.

Parameters
valueThe number of seconds to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value seconds

◆ AddTicks()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddTicks ( int64_t  value) const

Returns a new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and the specified number of 100-nanosecond intervals.

Parameters
valueThe number of 100-nanosecond intervals to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value which is the sum of the value represented by the current object and value of 100-nanosecond intervals

◆ AddYears()

ASPOSECPP_SHARED_API DateTime System::DateTime::AddYears ( int  value) const

Returns a new instance of the DateTime class representing the date and time value equal to that represented by the current object with the year component increased by the specified number.

Parameters
valueThe number of years to add; the value can be positive or negative
Returns
A new instance of the DateTime class representing the date and time value equal to that represented by the current object with the year component increased by value

◆ Compare()

static constexpr int System::DateTime::Compare ( DateTime  t1,
DateTime  t2 
)
inlinestatic

Compares two values represented by the specified instances of DateTime class and returns the value indicating values' relative positions on the time line.

Parameters
t1The first comparand
t2The second comparand
Returns
A value that is less than 0 if t1 is earlier than t2; 0 if t1 is the same as t2; a value that is greater than 0 if t1 is later than t2

◆ CompareTo()

constexpr int System::DateTime::CompareTo ( DateTime  value) const
inline

Compares two date and time values represented by the current object and the specified instance of DateTime class and returns the value indicating values' relative positions on the time line.

Parameters
valueAn instance of DateTime class to compare the current object with
Returns
A value that is less than 0 if the current object represents a value that is earlier than that represented by value; 0 if values represented by both objects are the same; a value that is greater than 0 if the value represented by the current object is later than that represented by value

◆ DaysInMonth()

static ASPOSECPP_SHARED_API int System::DateTime::DaysInMonth ( int  year,
int  month 
)
static

Returns the number of days in the specified month of the specified year.

Parameters
yearThe year
monthThe ordinal number of the month
Returns
The number of days is the specified month of the specified year

◆ Equals() [1/2]

static constexpr bool System::DateTime::Equals ( DateTime  t1,
DateTime  t2 
)
inlinestatic

Determines if the specified instances of DateTime class represent the same date and time value.

Parameters
t1The first comparand
t2The second comparand
Returns
True if both t1 and t2 represent the same value, otherwise - false

◆ Equals() [2/2]

constexpr bool System::DateTime::Equals ( DateTime  other) const
inline

Determines if the specified instance of DateTime class represent the same date and time value as the current object.

Parameters
otherThe instance of DateTime class to compare current object with
Returns
True if both other and current object represent the same value, otherwise - false

◆ FromBinary()

static ASPOSECPP_SHARED_API DateTime System::DateTime::FromBinary ( int64_t  value)
static

Deserializes the date time value from the specified unsigned 64-bit integer and sets the new instance of DateTime class to that value.

Parameters
valueThe 64-bit integer to deserialize the date and time value from
Returns
A new instance of DateTime class representing the date and time value deserialized from the specified unsigned 64-bit integer value

◆ FromFileTime()

static ASPOSECPP_SHARED_API DateTime System::DateTime::FromFileTime ( int64_t  value)
static

Converts the specified File time to an instance of DateTime class representing the same date and time value as local time.

Parameters
valueFile time to convert
Returns
A new instance of DateTime class representing the same date and time as file_time

◆ FromFileTimeUtc()

static ASPOSECPP_SHARED_API DateTime System::DateTime::FromFileTimeUtc ( int64_t  file_time)
static

Converts the specified File time to an instance of DateTime class representing the same date and time value as UTC time.

Parameters
file_timeFile time to convert
Returns
A new instance of DateTime class representing the same date and time as file_time

◆ FromOADate()

static ASPOSECPP_SHARED_API DateTime System::DateTime::FromOADate ( double  date)
static

Returns an instance of DateTime class representing the date and time value equivalent to the specified OLE Automation Date.

Parameters
dateOLE Automation Date to convert to DateTime object
Returns
A new instance of DateTime class representing the same date and time as date

◆ FromUnixTime()

static DateTime System::DateTime::FromUnixTime ( time_t  value)
static

Converts the specified Unix time value to an instance of DateTime class. FOR INTERNAL USE.

Parameters
valueUnix time value to convert
Returns
A new instance of DateTime class representing the same date and time as value

◆ get_Date()

constexpr DateTime System::DateTime::get_Date ( ) const
inline

Returns a new instance of DateTime class that represents the date portion of the date and time represented by the current object with each component of the time portion set to 0.

◆ get_Day()

ASPOSECPP_SHARED_API int System::DateTime::get_Day ( ) const

Returns the ordinal number of the day in the month represented by the current object.

◆ get_DayOfWeek()

constexpr DayOfWeek System::DateTime::get_DayOfWeek ( ) const
inline

Returns a value representing a day of week that is represented by the current object.

◆ get_DayOfYear()

ASPOSECPP_SHARED_API int System::DateTime::get_DayOfYear ( ) const

Returns the ordinal number of the day in the year represented by the current object.

◆ get_Hour()

constexpr int System::DateTime::get_Hour ( ) const
inline

Returns the hour component of the date and time value represented by the current object.

◆ get_Kind()

constexpr DateTimeKind System::DateTime::get_Kind ( ) const
inline

Returns the value representing if the date and time represented by the current object is a local or UTC date and time or neither.

◆ get_Millisecond()

constexpr int System::DateTime::get_Millisecond ( ) const
inline

Returns the millisecond component of the date and time value represented by the current object.

◆ get_Minute()

constexpr int System::DateTime::get_Minute ( ) const
inline

Returns the minute component of the date and time value represented by the current object.

◆ get_Month()

ASPOSECPP_SHARED_API int System::DateTime::get_Month ( ) const

Returns the ordinal number of the month in the year represented by the current object.

◆ get_Now()

static ASPOSECPP_SHARED_API DateTime System::DateTime::get_Now ( )
static

Returns an instance of DateTime class that represents the current time as local time.

◆ get_Second()

constexpr int System::DateTime::get_Second ( ) const
inline

Returns the second component of the date and time value represented by the current object.

◆ get_Ticks()

constexpr int64_t System::DateTime::get_Ticks ( ) const
inline

Returns a number of 100-nanosecond intervals passed since 0:00:00 UTC, January 1, 0001, in the Gregorian calendar until the date and time represented by the current object.

◆ get_TimeOfDay()

constexpr TimeSpan System::DateTime::get_TimeOfDay ( ) const
inline

Returns the value that represents the time interval from the beginning of the day represented by the current object till the date and time value represented by the current object.

◆ get_Today()

static ASPOSECPP_SHARED_API DateTime System::DateTime::get_Today ( )
static

Returns an instance of DateTime class that represents the current date with each component of time portion of the value represented by the object set to 0.

◆ get_UtcNow()

static ASPOSECPP_SHARED_API DateTime System::DateTime::get_UtcNow ( )
static

Returns an instance of DateTime class that represents the current time as UTC.

◆ get_Year()

ASPOSECPP_SHARED_API int System::DateTime::get_Year ( ) const

Returns the year represented by the current object.

◆ GetDateComponents()

void System::DateTime::GetDateComponents ( int &  year,
int &  month,
int &  day 
) const

Gets date parts. FOR INTERNAL USE.

◆ GetDateTimeFormats() [1/4]

ASPOSECPP_SHARED_API ArrayPtr<String> System::DateTime::GetDateTimeFormats ( ) const

Returns array of strings where each element is the string representation of the current object formatted with one of the standard date and time format specifiers.

◆ GetDateTimeFormats() [2/4]

ASPOSECPP_SHARED_API ArrayPtr<String> System::DateTime::GetDateTimeFormats ( char_t  format) const

Returns array of strings where each element is the string representation of the current object formatted with the specified standard date and time format specifier.

Parameters
formatStandard date and time format specifier.

◆ GetDateTimeFormats() [3/4]

ASPOSECPP_SHARED_API ArrayPtr<String> System::DateTime::GetDateTimeFormats ( const SharedPtr< IFormatProvider > &  provider) const

Returns array of strings where each element is the string representation of the current object formatted with one of the standard date and time format specifiers and the specified format provider.

Parameters
providerFormat provider.

◆ GetDateTimeFormats() [4/4]

ASPOSECPP_SHARED_API ArrayPtr<String> System::DateTime::GetDateTimeFormats ( char_t  format,
const SharedPtr< IFormatProvider > &  provider 
) const

Returns array of strings where each element is the string representation of the current object formatted with the specified standard date and time format specifier and format provider.

Parameters
formatStandard date and time format specifier.
providerFormat provider.

◆ GetHashCode()

ASPOSECPP_SHARED_API int System::DateTime::GetHashCode ( ) const

Returns a hash code for the current object.

◆ IsDaylightSavingTime()

ASPOSECPP_SHARED_API bool System::DateTime::IsDaylightSavingTime ( ) const

Determines if the date and time value represented by the current object falls in the range of daylight saving time for the current time zone.

Returns
True if the date and time value specified by the current object falls in the range of daylight saving time, otherwise - false

◆ IsLeapYear()

static ASPOSECPP_SHARED_API bool System::DateTime::IsLeapYear ( int  year)
static

Determines of the specified year is a leap year.

Parameters
yearThe year to check
Returns
True if the specified year is a leap year, otherwise - false

◆ IsNull()

constexpr bool System::DateTime::IsNull ( ) const
inline

◆ operator!=() [1/2]

constexpr bool System::DateTime::operator!= ( DateTime  other) const
inline

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

Parameters
otherThe DateTime 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::DateTime::operator!= ( std::nullptr_t  ) const
inline

◆ operator+()

DateTime System::DateTime::operator+ ( TimeSpan  value) const
inline

Returns a new instance of DateTime 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 DateTime class that represents the date and time value that is the sum of the value represented by the current object and value.

◆ operator+=()

DateTime& System::DateTime::operator+= ( TimeSpan  value)
inline

Sets the current object to 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
Returns
A reference to the self

◆ operator-() [1/2]

DateTime System::DateTime::operator- ( TimeSpan  value) const
inline

Returns a new instance of the DateTime 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 DateTime class representing the date and time value which is the result of subtraction of value from the value represented by the current object.

◆ operator-() [2/2]

constexpr TimeSpan System::DateTime::operator- ( DateTime  value) const
inline

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
valueAn 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 value.

◆ operator-=()

DateTime& System::DateTime::operator-= ( TimeSpan  value)
inline

Sets the current object to the date and time value that is the result of subtraction of the specified time span from the date and time value represented by the current object.

Parameters
valueThe time span to subtract
Returns
A reference to the self

◆ operator<() [1/2]

constexpr bool System::DateTime::operator< ( DateTime  other) const
inline

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

Parameters
otherThe DateTime 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::DateTime::operator< ( std::nullptr_t  ) const
inline

◆ operator<=() [1/2]

constexpr bool System::DateTime::operator<= ( DateTime  other) const
inline

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 DateTime object.

Parameters
otherThe DateTime 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::DateTime::operator<= ( std::nullptr_t  ) const
inline

◆ operator=()

DateTime& System::DateTime::operator= ( const DateTime dt)
default

Assigns the value represented by the specified DateTime instance to the current object.

Parameters
dtAn instance of DateTime class to copy the represented date and time value from
Returns
A reference to the self

◆ operator==() [1/2]

constexpr bool System::DateTime::operator== ( DateTime  other) const
inline

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

Parameters
otherThe DateTime 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::DateTime::operator== ( std::nullptr_t  ) const
inline

◆ operator>() [1/2]

constexpr bool System::DateTime::operator> ( DateTime  other) const
inline

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

Parameters
otherThe DateTime 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::DateTime::operator> ( std::nullptr_t  ) const
inline

◆ operator>=() [1/2]

constexpr bool System::DateTime::operator>= ( DateTime  other) const
inline

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 DateTime object.

Parameters
otherThe DateTime 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::DateTime::operator>= ( std::nullptr_t  ) const
inline

◆ Parse() [1/5]

static ASPOSECPP_SHARED_API DateTime System::DateTime::Parse ( const String s)
static

Converts the specified string representation of a date and time value to the equivalent DateTime object.

Parameters
sThe string representation of a date and time value to convert.
Returns
A new instance of DateTime class that represents the date and time value equivalent to that represented by the specified string.

◆ Parse() [2/5]

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

Converts the specified string representation of a date and time value to the equivalent DateTime object using culture-specific format information.

Parameters
sThe string representation of a date and time value to convert.
providerThe IFormatProvider object that provides culture-specific format information.
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateTime object.
Returns
A new instance of DateTime class that represents the date and time value equivalent to that represented by the specified string.

◆ Parse() [3/5]

static ASPOSECPP_SHARED_API DateTime System::DateTime::Parse ( const String s,
const SharedPtr< Globalization::CultureInfo > &  culture,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

◆ Parse() [4/5]

static ASPOSECPP_SHARED_API DateTime System::DateTime::Parse ( const String s,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

◆ Parse() [5/5]

static ASPOSECPP_SHARED_API DateTime System::DateTime::Parse ( const String s,
std::nullptr_t  ,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

◆ ParseExact() [1/8]

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

Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly. Throws an exception if the conversion fails.

Parameters
sThe string representation of a date and time value to convert.
formatThe string format.
providerThe IFormatProvider object that provides culture-specific format information.
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateTime object.
Returns
A new instance of DateTime class that represents the date and time value equivalent to that represented by the specified string.

◆ ParseExact() [2/8]

static ASPOSECPP_SHARED_API DateTime System::DateTime::ParseExact ( const String s,
const String format,
const SharedPtr< Globalization::CultureInfo > &  culture,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

◆ ParseExact() [3/8]

static ASPOSECPP_SHARED_API DateTime System::DateTime::ParseExact ( const String s,
const String format,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

◆ ParseExact() [4/8]

static ASPOSECPP_SHARED_API DateTime System::DateTime::ParseExact ( const String s,
const String format,
std::nullptr_t  ,
Globalization::DateTimeStyles  styles = Globalization::DateTimeStyles::None 
)
static

◆ ParseExact() [5/8]

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

Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified formats, culture-specific format information and style. The format of the string representation must match one or more of the specified formats exactly. Throws an exception if the conversion fails.

Parameters
sThe string representation of a date and time value to convert.
formatsThe array of string formats.
providerThe IFormatProvider object that provides culture-specific format information.
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateTime object.
Returns
A new instance of DateTime class that represents the date and time value equivalent to that represented by the specified string.

◆ ParseExact() [6/8]

static ASPOSECPP_SHARED_API DateTime System::DateTime::ParseExact ( const String s,
const ArrayPtr< String > &  formats,
const SharedPtr< Globalization::CultureInfo > &  culture,
Globalization::DateTimeStyles  styles 
)
static

◆ ParseExact() [7/8]

static ASPOSECPP_SHARED_API DateTime System::DateTime::ParseExact ( const String s,
const ArrayPtr< String > &  formats,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi,
Globalization::DateTimeStyles  styles 
)
static

◆ ParseExact() [8/8]

static ASPOSECPP_SHARED_API DateTime System::DateTime::ParseExact ( const String s,
const ArrayPtr< String > &  formats,
std::nullptr_t  ,
Globalization::DateTimeStyles  styles 
)
static

◆ SpecifyKind()

static DateTime System::DateTime::SpecifyKind ( DateTime  value,
DateTimeKind  kind 
)
inlinestatic

Constructs a new DateTime object that represents the same number of ticks as the specified DateTime object and represents local time, UTC time or neither as specified by the argument kind.

Parameters
valueThe DateTime object to copy the number of ticks from
kindSpecifies if the new object should represent local time, UTC time or neither.
Returns
A new DateTime object that represents the same number of ticks as value and DateTimeKind value specified by kind.

◆ Subtract() [1/2]

ASPOSECPP_SHARED_API DateTime System::DateTime::Subtract ( TimeSpan  duration) const

Returns a new instance of the DateTime 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
durationA time interval to subtract
Returns
A new instance of the DateTime class representing the date and time value which is the result of subtraction of duration from the value represented by the current object.

◆ Subtract() [2/2]

constexpr TimeSpan System::DateTime::Subtract ( DateTime  value) const
inline

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

Parameters
valueAn 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 value.

◆ ToBinary()

ASPOSECPP_SHARED_API int64_t System::DateTime::ToBinary ( ) const

Serializes the current object.

Returns
An unsigned 64-bit integer value representing the current object

◆ ToFileTime()

ASPOSECPP_SHARED_API int64_t System::DateTime::ToFileTime ( ) const

Returns a value that represents the date and time value represented by the current object as File time.

◆ ToFileTimeUtc()

ASPOSECPP_SHARED_API int64_t System::DateTime::ToFileTimeUtc ( ) const

Converts the date and time value represented by the current object to File time UTC.

Returns
The File time value equivalent to the date and time value represented by the current object

◆ ToLocalTime()

ASPOSECPP_SHARED_API DateTime System::DateTime::ToLocalTime ( ) const

Returns a new instance of DateTime class that represents the date and time value represented by the current object as local time.

◆ ToLongDateString()

ASPOSECPP_SHARED_API String System::DateTime::ToLongDateString ( ) const

Returns a string that contains the long date string representation of the current object.

◆ ToLongTimeString()

ASPOSECPP_SHARED_API String System::DateTime::ToLongTimeString ( ) const

Returns a string that contains the long time string representation of the current object.

◆ ToOADate()

ASPOSECPP_SHARED_API double System::DateTime::ToOADate ( ) const

Returns the date and time value represented by the current object as OLE Automation Date.

◆ ToShortDateString()

ASPOSECPP_SHARED_API String System::DateTime::ToShortDateString ( ) const

Returns a string that contains the short date string representation of the current object.

◆ ToShortTimeString()

ASPOSECPP_SHARED_API String System::DateTime::ToShortTimeString ( ) const

Returns a string that contains the short time string representation of the current object.

◆ ToString() [1/10]

ASPOSECPP_SHARED_API String System::DateTime::ToString ( ) const

Returns the string representation of the date and time value represented by the current object using the formatting conventions defined by the current culture.

Returns
The string representation of the value represented by the current object

◆ ToString() [2/10]

ASPOSECPP_SHARED_API String System::DateTime::ToString ( const String format) const

Returns a string representation of the date and time value represented by the current object using the specified format and formatting conventions defined by the current culture.

Parameters
formatA format string
Returns
The string representation of the value represented by the current object formatted according to format defined by format and the current culture.

◆ ToString() [3/10]

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

Returns a string representation of the date and time value represented by the current object using the specified format information.

Parameters
providerAn object representing the format information
Returns
The string representation of the value represented by the current object formatted according to format information provided by formatProvider.

◆ ToString() [4/10]

ASPOSECPP_SHARED_API String System::DateTime::ToString ( const SharedPtr< Globalization::CultureInfo > &  culture) const

◆ ToString() [5/10]

ASPOSECPP_SHARED_API String System::DateTime::ToString ( const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi) const

◆ ToString() [6/10]

String System::DateTime::ToString ( std::nullptr_t  ) const
inline

◆ ToString() [7/10]

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

Returns a string representation of the date and time value represented by the current object using the specified format information.

Parameters
formatA format string
providerAn object representing the format information
Returns
The string representation of the value represented by the current object formatted according to format information provided by provider and format string format.

◆ ToString() [8/10]

ASPOSECPP_SHARED_API String System::DateTime::ToString ( const String format,
const SharedPtr< Globalization::CultureInfo > &  culture 
) const

◆ ToString() [9/10]

ASPOSECPP_SHARED_API String System::DateTime::ToString ( const String format,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi 
) const

◆ ToString() [10/10]

String System::DateTime::ToString ( const String format,
std::nullptr_t   
) const
inline

◆ ToUniversalTime()

ASPOSECPP_SHARED_API DateTime System::DateTime::ToUniversalTime ( ) const

Returns a new instance of DateTime class that represents the date and time value represented by the current object as UTC.

◆ ToUnixTime()

time_t System::DateTime::ToUnixTime ( ) const

Returns a value that represents the date and time value represented by the current object as Unix time. FOR INTERNAL USE.

◆ TryParse() [1/5]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParse ( const String s,
DateTime result 
)
static

Converts the specified string representation of a date and time value to the equivalent DateTime object.

Parameters
sThe string representation of a date and time value to convert.
resultThe output argument that, if the conversion succeeds, contains the result of conversion.
Returns
True if conversion succeeds, otherwise - false.

◆ TryParse() [2/5]

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

Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified culture-specific format information and style.

Parameters
sThe string representation of a date and time value to convert.
providerThe IFormatProvider object that provides culture-specific format information.
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateTime object.
resultThe output argument that, if the conversion succeeds, contains the result of conversion.
Returns
True if conversion succeeds, otherwise - false.

◆ TryParse() [3/5]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParse ( const String s,
const SharedPtr< Globalization::CultureInfo > &  culture,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParse() [4/5]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParse ( const String s,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParse() [5/5]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParse ( const String s,
std::nullptr_t  ,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParseExact() [1/8]

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

Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified format, culture-specific format information and style. The format of the string representation must match the specified format exactly.

Parameters
sThe string representation of a date and time value to convert.
formatThe string format.
providerThe IFormatProvider object that provides culture-specific format information.
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateTime object.
resultThe output argument that, if the conversion succeeds, contains the result of conversion.
Returns
True if conversion succeeds, otherwise - false.

◆ TryParseExact() [2/8]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParseExact ( const String s,
const String format,
const SharedPtr< Globalization::CultureInfo > &  culture,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParseExact() [3/8]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParseExact ( const String s,
const String format,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParseExact() [4/8]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParseExact ( const String s,
const String format,
std::nullptr_t  ,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParseExact() [5/8]

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

Converts the specified string representation of a date and time value to the equivalent DateTime object using the specified formats, culture-specific format information and style. The format of the string representation must match one or more of the specified formats exactly.

Parameters
sThe string representation of a date and time value to convert.
formatsThe array of string formats.
providerThe IFormatProvider object that provides culture-specific format information.
stylesA bitwise combination of the enumeration values that provides additional information about s, about style elements that may be present in s, or about the conversion from s to a DateTime object.
resultThe output argument that, if the conversion succeeds, contains the result of conversion.
Returns
True if conversion succeeds, otherwise - false.

◆ TryParseExact() [6/8]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParseExact ( const String s,
const ArrayPtr< String > &  formats,
const SharedPtr< Globalization::CultureInfo > &  culture,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParseExact() [7/8]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParseExact ( const String s,
const ArrayPtr< String > &  formats,
const SharedPtr< Globalization::DateTimeFormatInfo > &  dtfi,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ TryParseExact() [8/8]

static ASPOSECPP_SHARED_API bool System::DateTime::TryParseExact ( const String s,
const ArrayPtr< String > &  formats,
std::nullptr_t  ,
Globalization::DateTimeStyles  styles,
DateTime result 
)
static

◆ Type()

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

Returns a TypeInfo object that contains information about this class.

Member Data Documentation

◆ MaxTicks

constexpr int64_t System::DateTime::MaxTicks = 3652059 * TicksPerDay - 1
static

The number of 100-nanosecond in the time interval between the minimal possible and maximal possible DateTime value.

◆ MaxValue

ASPOSECPP_SHARED_API const DateTime System::DateTime::MaxValue
static

An instance of DateTime class that represents the maximal possible date and time value.

◆ MinTicks

constexpr int64_t System::DateTime::MinTicks = 0
static

The minimal number of ticks that an instance of DateTime class can represent.

◆ MinValue

ASPOSECPP_SHARED_API const DateTime System::DateTime::MinValue
static

An instance of DateTime class that represents the minimal possible date and time value.

◆ TicksPerDay

constexpr int64_t System::DateTime::TicksPerDay = TicksPerHour * 24
static

The number of ticks in a day.

◆ TicksPerHour

constexpr int64_t System::DateTime::TicksPerHour = TicksPerMinute * 60
static

The number of ticks in a hour.

◆ TicksPerMicrosecond

constexpr int64_t System::DateTime::TicksPerMicrosecond = 10
static

The number of ticks in a microsecond.

◆ TicksPerMillisecond

constexpr int64_t System::DateTime::TicksPerMillisecond = 10000
static

The number of ticks in a millisecond.

◆ TicksPerMinute

constexpr int64_t System::DateTime::TicksPerMinute = TicksPerSecond * 60
static

The number of ticks in a minute.

◆ TicksPerSecond

constexpr int64_t System::DateTime::TicksPerSecond = TicksPerMillisecond * 1000
static

The number of ticks in a second.

◆ UnixEpoch

ASPOSECPP_SHARED_API const DateTime System::DateTime::UnixEpoch
static

An instance of DateTime class that represents the Unix epoch start (1970.01.01 00:00:00).