User Tools

Site Tools


time_calculations

This is an old revision of the document!


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))"

Convert UTC date/time to local timezone

date -d '2012-08-08 16:00 UTC'
Wed Aug  8 18:00:00 CEST 2012

date -d '2012-12-08 16:00 UTC'
Sat Dec  8 17:00:00 CET 2012

Convert current local time to UTC

date --utc
Wed Aug  8 12:35:15 UTC 2012
time_calculations.1344429431.txt.gz · Last modified: 2012/08/08 12:37 by root