This shows you the differences between two versions of the page.
|
time_calculations [2013/04/08 15:37] root |
time_calculations [2013/09/19 08:17] (current) root |
||
|---|---|---|---|
| Line 14: | Line 14: | ||
| - | ==== Epoch time on system without GNU date ==== | + | ==== Current Epoch time on system without GNU date ==== |
| perl -e 'print time(), "\n" ' | perl -e 'print time(), "\n" ' | ||
| | | ||
| - | ==== Convert from Epoch with perl ==== | + | ==== Convert from Epoch to date with GNU date ==== |
| + | |||
| + | date -d @<EPOCH time> | ||
| + | Example: | ||
| + | date -d @1368023418 | ||
| + | Wed May 8 16:30:18 CEST 2013 | ||
| + | |||
| + | |||
| + | ==== Convert from Epoch to date with perl ==== | ||
| | | ||
| perl -e "print scalar(localtime(1268727836))" | perl -e "print scalar(localtime(1268727836))" | ||
| + | | ||
| + | ==== Convert date to epoch ==== | ||
| + | |||
| + | date -d 'Apr 30 14:40:09 2012' +%s | ||
| + | |||
| + | ==== Convert date 14 days ago to epoch ==== | ||
| + | |||
| + | date -d '14 days ago' +%s | ||
| ==== Find date for last password change for Linux user ==== | ==== Find date for last password change for Linux user ==== | ||