.. index:: pair: struct; EE::System::LocalDateTime .. _doxid-struct_e_e_1_1_system_1_1_local_date_time: struct EE::System::LocalDateTime ================================ .. toctree:: :hidden: Overview ~~~~~~~~ A local civil date and wall-clock time. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct LocalDateTime { // fields :ref:`CalendarDate` :target:`date`; :ref:`TimeOfDay` :target:`time`; // methods bool :target:`isValid`() const; std::optional<:ref:`Int64`> :ref:`toUnixTimestamp`(:ref:`Int32` utcOffsetSeconds = 0) const; std::optional<:ref:`Int64`> :ref:`toUnixTimestampMilliseconds`(:ref:`Int32` utcOffsetSeconds = 0) const; LocalDateTime :target:`addHours`(:ref:`Int64` hours) const; LocalDateTime :target:`addMinutes`(:ref:`Int64` minutes) const; LocalDateTime :target:`addSeconds`(:ref:`Int64` seconds) const; auto :target:`operator`(const LocalDateTime&) const; static std::optional :ref:`fromUnixTimestamp`(:ref:`Int64` seconds, :ref:`Int32` utcOffsetSeconds = 0); static std::optional :ref:`fromUnixTimestampMilliseconds`(:ref:`Int64` milliseconds, :ref:`Int32` utcOffsetSeconds = 0); static LocalDateTime :target:`now`(); }; .. _details-struct_e_e_1_1_system_1_1_local_date_time: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ A local civil date and wall-clock time. This value does not imply a timezone. Methods ------- .. index:: pair: function; toUnixTimestamp .. _doxid-struct_e_e_1_1_system_1_1_local_date_time_1aa20787e3cf10c59fadf4b89d2955fde1: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::optional<:ref:`Int64`> toUnixTimestamp(:ref:`Int32` utcOffsetSeconds = 0) const Unix seconds using a UTC offset in seconds (local = UTC + offset), defaulting to UTC. Discards milliseconds; returns nullopt for an invalid value. Does not infer the system timezone or resolve daylight-saving transitions. .. index:: pair: function; toUnixTimestampMilliseconds .. _doxid-struct_e_e_1_1_system_1_1_local_date_time_1aa1c59202b19f26ccf3942f1623a4a847: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::optional<:ref:`Int64`> toUnixTimestampMilliseconds(:ref:`Int32` utcOffsetSeconds = 0) const Unix milliseconds preserving the millisecond field, with the same offset convention. Returns nullopt for an invalid value or an Int64 timestamp overflow. .. index:: pair: function; fromUnixTimestamp .. _doxid-struct_e_e_1_1_system_1_1_local_date_time_1a397a1f3b4add7b4e01a9dafbc323a579: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::optional fromUnixTimestamp(:ref:`Int64` seconds, :ref:`Int32` utcOffsetSeconds = 0) Civil date/time at the given UTC offset (default: UTC), with zero milliseconds. Returns nullopt if the result is outside the Int32 year range. .. index:: pair: function; fromUnixTimestampMilliseconds .. _doxid-struct_e_e_1_1_system_1_1_local_date_time_1ae969a47623734a900c11e5dcf032630b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::optional fromUnixTimestampMilliseconds(:ref:`Int64` milliseconds, :ref:`Int32` utcOffsetSeconds = 0) Civil date/time at the given UTC offset (default: UTC), preserving milliseconds. Returns nullopt if the result is outside the Int32 year range.