4#include <system/date_time.h>
5#include <system/timespan.h>
6#include <system/boxable_traits.h>
21 static constexpr int64_t MinOffset = -MaxOffset;
51 ASPOSECPP_SHARED_API
DateTimeOffset(
int year,
int month,
int day,
int hour,
int minute,
int second,
TimeSpan offset);
61 ASPOSECPP_SHARED_API
DateTimeOffset(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
TimeSpan offset);
102 constexpr int get_Second()
const {
return m_date_time.get_Second(); }
336 return *static_holder<ThisTypeInfo>();
339 constexpr bool IsNull()
const {
return false; }
340 constexpr bool operator==(std::nullptr_t)
const {
return false; }
341 constexpr bool operator!=(std::nullptr_t)
const {
return true; }
342 constexpr bool operator<(std::nullptr_t)
const {
return false; }
343 constexpr bool operator<=(std::nullptr_t)
const {
return false; }
344 constexpr bool operator>(std::nullptr_t)
const {
return false; }
345 constexpr bool operator>=(std::nullptr_t)
const {
return false; }
370template<>
struct IsBoxable<DateTimeOffset> : std::true_type {};
400 class hash<
System::DateTimeOffset>
404 using result_type = std::size_t;
406 result_type operator()(
const argument_type& value)
const
408 return static_cast<result_type
>(value.GetHashCode());
Represents a specific date and time value on the time continuum. This type should be allocated on sta...
Definition: date_time.h:50
Contains the date and time of day relative to Coordinated Universal Time. Objects of this class shoul...
Definition: date_time_offset.h:16
static int Compare(const DateTimeOffset &first, const DateTimeOffset &second)
Compares two DateTimeOffset objects.
bool EqualsExact(const SharedPtr< Object > &obj) const
Checks if two DateTimeOffset objects represents the same time point and has the same offset.
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...
TimeSpan Subtract(const DateTimeOffset &value) const
Subtracts a specified DateTimeOffset value from the current object.
DateTime get_UtcDateTime() const
Gets DateTime value that represents the UTC date and time.
static const TypeInfo & Type()
Returns a TypeInfo object that represent TimeSpan structure.
Definition: date_time_offset.h:334
bool operator>(const DateTimeOffset &other) const
Determines if the current object represents the date and time value that is later than the value repr...
DayOfWeek get_DayOfWeek() const
Gets day of the week of the current object.
static DateTimeOffset FromUnixTimeMilliseconds(int64_t milliseconds)
Convert Unix-time to DateTimeOffset object.
DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset)
Constructor.
int GetHashCode() const
Gets hash code for the current DateTimeOffset object.
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,...
int CompareTo(const DateTimeOffset &other) const
Compares two DateTimeOffset objects.
int get_Day() const
Gets day of the month of the current object.
int64_t ToUnixTimeSeconds() const
Gets seconds elapsed from Unix epoch start.
bool operator!=(const DateTimeOffset &other) const
Determines if the current object and the specified DateTimeOffset object represent distinct date and ...
constexpr bool operator<(std::nullptr_t) const
Definition: date_time_offset.h:342
int get_Month() const
Gets month component of the current object.
DateTimeOffset ToOffset(TimeSpan offset) const
Replace current object offset by the specified offset.
bool operator==(const DateTimeOffset &other) const
Determines if the current object and the specified DateTimeOffset object represent the same date and ...
DateTime get_Date() const
Gets date component of the current object.
String ToString(const String &format) const
Converts current object to string using the specified format.
DateTimeOffset AddDays(double days) const
Adds a specified number of days to the DateTimeOffset object.
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 format...
DateTimeOffset AddTicks(int64_t ticks) const
Adds a specified number of ticks to the DateTimeOffset object.
int64_t ToFileTime() const
Converts current object to the Windows file time.
DateTimeOffset AddMilliseconds(double milliseconds) const
Adds a specified number of milliseconds to the DateTimeOffset object.
DateTimeOffset AddMonths(int months) const
Adds a specified number of months to the DateTimeOffset object.
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 a...
DateTime get_DateTime() const
Gets DateTime value.
constexpr bool operator==(std::nullptr_t) const
Definition: date_time_offset.h:340
String ToString() const
Converts current object to string.
int get_Year() const
Gets year component of the current object.
constexpr bool operator>(std::nullptr_t) const
Definition: date_time_offset.h:344
int64_t get_Ticks() const
Gets number of ticks of the current object.
static DateTimeOffset FromFileTime(int64_t file_time)
Convert Windows file time to date and time with local time offset.
DateTimeOffset AddMinutes(double minutes) const
Adds a specified number of minutes to the DateTimeOffset object.
static DateTimeOffset FromUnixTimeSeconds(int64_t seconds)
Convert Unix-time to DateTimeOffset object.
DateTime get_LocalDateTime() const
Gets DateTime value that represents the local date and time.
int CompareTo(const SharedPtr< Object > &obj) const
Compares two DateTimeOffset objects.
DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, const SharedPtr< Globalization::Calendar > &calendar, TimeSpan offset)
Constructor.
String ToString(const String &format, const SharedPtr< IFormatProvider > &provider) const
Converts current object to string using the specified format and format provider.
constexpr int get_Second() const
Gets second component of the current object.
Definition: date_time_offset.h:102
static DateTimeOffset Parse(const String &input)
Converts the specified string to DateTimeOffset equivalent.
bool operator<(const DateTimeOffset &other) const
Determines if the current object represents the date and time value that is earlier than the value re...
static DateTimeOffset get_UtcNow()
Gets DateTimeOffset whose date and time are set to the current UTC-time and whose offset is TimeSpan:...
DateTimeOffset operator+(TimeSpan value) const
Returns a new instance of DateTimeOffset class that represents the date and time value that is the su...
String ToString(const SharedPtr< IFormatProvider > &provider) const
Converts current object to string using the specified format provider.
DateTimeOffset AddYears(int years) const
Adds a specified number of years to the DateTimeOffset object.
constexpr DateTimeOffset()=default
Default constructor.
static bool Equals(const DateTimeOffset &first, const DateTimeOffset &second)
Checks if two DateTimeOffset objects represent the same time point.
bool EqualsExact(const DateTimeOffset &other) const
Checks if two DateTimeOffset objects represents the same time point and has the same offset.
DateTimeOffset ToLocalTime() const
Converts current object to a object that represents the local time,.
DateTimeOffset Add(TimeSpan value) const
Adds a specified time interval to the DateTimeOffset object.
static DateTimeOffset get_Now()
Gets DateTimeOffset whose date and time are set to the current local-time and whose offset is set to ...
static const DateTimeOffset MaxValue
Gets greatest DateTimeOffset value.
Definition: date_time_offset.h:26
DateTimeOffset operator-(TimeSpan value) const
Returns a new instance of the DateTimeOffset class representing the date and time value which is the ...
static const DateTimeOffset UnixEpoch
Gets Unix epoch start.
Definition: date_time_offset.h:28
DateTimeOffset(DateTime date_time, TimeSpan offset)
Constructor.
DateTimeOffset(DateTime date_time)
Constructor.
int get_DayOfYear() const
Gets day of year of the current object.
constexpr TimeSpan get_Offset() const
Gets offset from UTC.
Definition: date_time_offset.h:106
bool operator<=(const DateTimeOffset &other) const
Determines if the current object represents the date and time value that is earlier than or the same ...
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,...
TimeSpan get_TimeOfDay() const
Gets time of day of the current object.
constexpr bool IsNull() const
Definition: date_time_offset.h:339
constexpr bool operator<=(std::nullptr_t) const
Definition: date_time_offset.h:343
int get_Minute() const
Gets minute component of the current object.
bool Equals(const DateTimeOffset &other) const
Checks if two DateTimeOffset objects represents the same time point.
DateTimeOffset Subtract(TimeSpan value) const
Subtracts a specified time interval from the current object.
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,...
DateTimeOffset AddHours(double hours) const
Adds a specified number of hours to the DateTimeOffset object.
int64_t ToUnixTimeMilliseconds() const
Gets milliseconds elapsed from Unix epoch start.
static const DateTimeOffset MinValue
Gets earliest DateTimeOffset value.
Definition: date_time_offset.h:24
DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset)
Constructor.
DateTimeOffset ToUniversalTime() const
Converts current object to a object that represents the UTC time,.
static bool TryParse(const String &input, DateTimeOffset &result)
Tries to converts the specified string to DateTimeOffset object.
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,...
int64_t get_UtcTicks() const
Gets number of ticks of the current object in UTC time.
constexpr bool operator>=(std::nullptr_t) const
Definition: date_time_offset.h:345
DateTimeOffset(int64_t ticks, TimeSpan offset)
Constructor.
TimeSpan operator-(const DateTimeOffset &other) const
Returns an instance of TimeSpan class that represents the time interval between the date and time val...
constexpr bool operator!=(std::nullptr_t) const
Definition: date_time_offset.h:341
bool Equals(const SharedPtr< Object > &obj) const
Checks if two DateTimeOffset objects represents the same time point.
constexpr int get_Millisecond() const
Gets millisecond component of the current object.
Definition: date_time_offset.h:104
int get_Hour() const
Gets hour component of the current object.
DateTimeOffset AddSeconds(double seconds) const
Adds a specified number of seconds to the DateTimeOffset object.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Represents a time interval. This type should be allocated on stack and passed to functions by value o...
Definition: timespan.h:59
static constexpr int64_t TicksPerHour
The number of 100-nanoseconds intervals in a hour.
Definition: timespan.h:71
Represents a particular type and provides information about it.
Definition: type_info.h:109
DateTimeStyles
Defines date and time formatting options. Bit flags.
Definition: date_time_styles.h:12
Definition: db_command.h:9
void PrintTo(DateTime value, std::ostream *stream)
Prints value to ostream. Mostly used for debug.
bool operator!=(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:157
constexpr bool operator>(std::nullptr_t, DateTime)
Definition: date_time.h:714
DayOfWeek
Enumeration that represents a day of week.
Definition: day_of_week.h:11
std::ostream & operator<<(std::ostream &stream, DateTime date_time)
Insert data into the stream using UTF-8 encoding.
Definition: date_time.h:729
constexpr bool operator<(std::nullptr_t, DateTime)
Definition: date_time.h:712
constexpr bool operator<=(std::nullptr_t, DateTime)
Definition: date_time.h:713
constexpr bool operator>=(std::nullptr_t, DateTime)
Definition: date_time.h:715
bool operator==(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:151
Wrapper for a pointer to an instance of TypeInfo class. This type should be allocated on stack and pa...
Definition: type_info.h:72