1

Could you please help me in fetching the correct result for days addition to current date.

app503l:datechecker ~ $ date
Thu May 18 13:54:41 AEST 2017

How can I add 55 days to it?

codeforester
  • 39,467
  • 16
  • 112
  • 140
Rohith
  • 1,077
  • 5
  • 16
  • 36

2 Answers2

1

I got the solution..!

a=55
export a
perl -e 'use POSIX qw(strftime); print strftime "%a %b %e %H:%M:%S %Y",localtime(time()+ 3600*24*$ENV{a});'

I have used perl to add 55 days to the current local time on the server.

Thanks..!

Rohith
  • 1,077
  • 5
  • 16
  • 36
0

How about:

now=$(date +%s)
new=$((now + 55*86400))
date -r $new

With GNU date:

date -d @$new
codeforester
  • 39,467
  • 16
  • 112
  • 140