getting time mins ago

Hi
I trying to get 5 mins ago time using below command
echo `date +%R -d "1 min ago"`

but this is giving only current time. Please help

If you want 5 minutes ago, don't use "1 min ago". "1 min ago" is only 1 minute ago.

$ date "+%R"; date  "+%R" -d "1 min ago"
12:54
12:53
$

Thanks for you reply. but I am getting same results for both

% echo `date "+%R"; date "+%R" -d "1 min ago"`
13:27 13:27

Simple .. you answer in your question itself

$ date "+%R"
21:25
$ date "+%R" -d "5 mins ago"
21:20

:slight_smile:

What Operating System are you running?
A normal unix "date" command does not support the "-d" switch and just ignores it !
Many versions of Linux support this extension to the "date" command.

Still same May be i am missing some thing?
bash-2.05$ date
Wed Jan 5 13:35:30 EST 2011
bash-2.05$ date "+%R" -d "5 mins ago"
13:35

What Operating System are you running?

Does your "man date" describe a "-d" switch ?