This shows you the differences between two versions of the page.
epoch_time_calculations [2012/02/16 11:32] root |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Epoch time calculations ====== | ||
- | ===== Days since Epoch ===== | ||
- | |||
- | echo $(date +%s)/86400 | bc | ||
- | echo $(($(date +%s)/86400)) | ||
- | let days=$(date +%s)/86400 ; echo $days | ||
- | |||
- | ===== Days since Epoch without GNU date ===== | ||
- | |||
- | If perl is installed: | ||
- | |||
- | perl -e ' $days=int(time()/86400);print "$days\n"; ' | ||
- | |||
- | |||
- | ===== Epoch time on system without GNU date ===== | ||
- | |||
- | perl -e 'print time(), "\n" ' | ||
- | | ||
- | ===== Convert from Epoch with perl ===== | ||
- | | ||
- | perl -e "print scalar(localtime(1268727836))" | ||
- | |||
- | | ||
- | |