We can use the following functions to convert between a timestamp and the number of seconds since the Epoch.
mbfl_declare_varref(SECONDS) mbfl_declare_varref(TIMESTAMP) mbfl_date_to_epoch_var _(SECONDS) '2024-08-22T06:27:24+0200' "$SECONDS" ⇒ 1724300844 mbfl_date_from_epoch_var _(TIMESTAMP) '1724300844' "$TIMESTAMP" ⇒ 2024-08-22T06:27:24+0200
Store in the result variable EPOCH_SECONDS_RV the number of seconds since the Epoch
representing the timestamp TIMESTAMP_SPEC, which must be compatible with the option
--date of date
. If successful return true, otherwise return false.
Store in the result variable TIMESTAMP_RV a timestamp description according to the format:
%Y-%m-%dT%H:%M:%S%z
representing the number of seconds since the Epoch EPOCH_SECONDS. If successful return true, otherwise return false.
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.