bash
5.0 natively supports retrieving seconds since Epoch using a variable.
Native bash
method
|
|
If seconds are preferred:
|
|
If milliseconds are preferred:
|
|
Using date
In addition to using the native bash
method, date
may be used.
According to the date
manual:
%s seconds since the Epoch (1970-01-01 00:00 UTC)
|
|
If milliseconds seconds are preferred:
|
|