how to find the time before 30 minutes

Hi All,

I want to find out the time before 30 minutes. I am able to do with in hours limit.

date
Fri Aug 21 06:50:00 BST 2009

TZ=CST+1 date
Fri Aug 21 04:50:02 CST 2009

Can any one please help me

why are you working on 2 different time zones?

If you are using bash you can try using the --date option. Sonething like this

sh-3.2$ date
Fri Aug 21 01:16:57 CDT 2009
sh-3.2$ date --date="Fri Aug 21 01:16:57 -4:30"
Fri Aug 21 00:46:57 CDT 2009
sh-3.2$
perl -le 'print scalar localtime (time() - 2*60*60);'

Thanks a lot. This is what i was expecting. As i am new to perl. Could you please tell me hoie can i pass parameterized value to this command. As after some time my requirement is changed for 50 mins instead of 30 mins.

$ date -d '-30 min'

on Linux.

Something Like this :

var=50
perl -le "print scalar localtime (time() -  "$var"*60);"

To be frank i am not much aware of the "perl", how ever this one i was using for date related issues. So posted.