.. index:: pair: struct; EE::System::CalendarDate .. _doxid-struct_e_e_1_1_system_1_1_calendar_date: struct EE::System::CalendarDate =============================== .. toctree:: :hidden: Overview ~~~~~~~~ Civil Gregorian calendar date without timezone or timestamp semantics. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct CalendarDate { // fields :ref:`Int32` :target:`year` { 1970 }; :ref:`Uint8` :target:`month` { 1 }; :ref:`Uint8` :target:`day` { 1 }; // methods bool :target:`isValid`() const; int :target:`daysInMonth`() const; :ref:`Int64` :ref:`daysSinceEpoch`() const; std::optional<:ref:`Int64`> :ref:`toUnixTimestamp`() const; CalendarDate :target:`addDays`(:ref:`Int64` days) const; CalendarDate :target:`addMonths`(:ref:`Int64` months) const; CalendarDate :target:`addYears`(:ref:`Int64` years) const; auto :target:`operator`(const CalendarDate&) const; static std::optional :ref:`fromUnixTimestamp`(:ref:`Int64` seconds); static bool :target:`isLeapYear`(:ref:`Int32` year); static int :target:`daysInMonth`(:ref:`Int32` year, :ref:`Uint8` month); static CalendarDate :target:`today`(); }; .. _details-struct_e_e_1_1_system_1_1_calendar_date: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Civil Gregorian calendar date without timezone or timestamp semantics. Arithmetic outside the Int32 year range leaves the value unchanged. Methods ------- .. index:: pair: function; daysSinceEpoch .. _doxid-struct_e_e_1_1_system_1_1_calendar_date_1a667ef4df8f9b8db9cf869e3f04053c60: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Int64` daysSinceEpoch() const Signed number of Gregorian days since 1970-01-01; requires a valid date. .. index:: pair: function; toUnixTimestamp .. _doxid-struct_e_e_1_1_system_1_1_calendar_date_1ae67dd14d43de60d471d2e03756b73b85: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::optional<:ref:`Int64`> toUnixTimestamp() const Unix seconds at midnight UTC; returns nullopt for an invalid date. .. index:: pair: function; fromUnixTimestamp .. _doxid-struct_e_e_1_1_system_1_1_calendar_date_1a0ac41da330acac3bcefa0c86899e113e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::optional fromUnixTimestamp(:ref:`Int64` seconds) UTC date containing the Unix timestamp, including negative timestamps. Returns nullopt if the date is outside the Int32 year range.