How long ago since time - Using perl

echo "1337124526" | perl -pe 's/(\d+)/easttime($1)/e'

the above gives a date and time.

how can i subtract the date and time given by this command, from the current present date?

can this be a one liner or as close to a one-liner as possible?

You get now with:

date +%s

so all you really need is:

echo "($(date +%s) - 1337124526)/(60*60)" | bc -l

Result in hours.

1 Like