|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Adding hours to current date
Hi,
any idea how to add hours to current date in unix. thanks in advance |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
This works on my GNU bash: Code:
date -d "+5 hours" |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
didn't worked on my solaris Code:
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 Last edited by Franklin52; 02-22-2012 at 05:03 AM.. Reason: Please use code tags for code and data samples, thank you |
|
#4
|
||||
|
||||
|
This adds 5 hours to current time. Code:
perl -e '$x=localtime(time+(5*3600));print $x' |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
hey thanks!! i did the same but in multiple lines.. you are great
![]() |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
In nawk .. Code:
$ nawk 'BEGIN{print "0t"srand()+(5*3600)"=Y"}' | /usr/bin/adb |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
hey jayan,
i dont have any idea about these AWK.. can you explain your statement..? |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delete a row from a file if one column containing a date is greater than the current system date | chumsky | UNIX for Dummies Questions & Answers | 4 | 07-06-2011 02:07 AM |
| Execute crontab for every 4 hours and begin from current time | Ganeshwari | UNIX for Dummies Questions & Answers | 7 | 05-31-2011 12:34 PM |
| Adding or subtracting days from current date in batch script | anand1773 | Windows & DOS: Issues & Discussions | 2 | 01-12-2011 02:38 PM |
| Reading Hours and Minutes from file and comparing with current | SGD | Shell Programming and Scripting | 1 | 03-17-2009 01:12 PM |
| How to use datecalc for adding hours | ucbus | UNIX for Dummies Questions & Answers | 5 | 06-03-2008 04:48 PM |
|
|