How can you calculate the number of days since 1/1/1970? This is for updating the shadowLastChange attribute on OpenLDAP.
Is there a way to do this using the linux date command?
|
ring0 beat me by a few seconds, but the full command is:
This goes by UTC time. Result:
A quick check with WolframAlpha shows that this is the correct value. |
||||
|
|
|
The
You can divide the result by E.g. in Bash
to display the number of days. |
||||
|
|
$()is preferred over backticks for readability and other reasons.echo $(( $(date ...) / 86400 ))– Dennis Williamson Jan 10 '11 at 14:03