Hi,
any idea how to add hours to current date in unix.
thanks in advance
Hi,
any idea how to add hours to current date in unix.
thanks in advance
This works on my GNU bash:
date -d "+5 hours"
didn't worked on my solaris
date -d "+5 hours"
date: illegal option -- d
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
---------- Post updated at 01:12 PM ---------- Previous update was at 01:06 PM ----------
any idea if i can use perl to add 5 hrs to the current date
This adds 5 hours to current time.
perl -e '$x=localtime(time+(5*3600));print $x'
hey thanks!! i did the same but in multiple lines.. you are great:)
In nawk ..
$ nawk 'BEGIN{print "0t"srand()+(5*3600)"=Y"}' | /usr/bin/adb
hey jayan,
i dont have any idea about these AWK.. can you explain your statement..?
Please present you shell name ...
[root@nagios ~]# echo $SHELL
/bin/bash
[root@nagios ~]# date
Wed Feb 22 21:45:04 IST 2012
[root@nagios ~]# date -d '+5 hour'
Thu Feb 23 02:45:07 IST 2012
[root@nagios ~]#
--Shirish Shukla
Hi Shukla,
There is nothing about shell. you are using the Gnu Date. But the questioner asked solution for solaris machine. (ie., NO GNU DATE in solaris )
yes.. there's diff in date cmd on linux and unix .. excuse have missed to read whole thread ...
Was asking for shell used to present script ..
Thnx .