The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 1 Day Ago 08:37 PM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 04:15 AM
Command DATE in UNIX System ZINGARO UNIX for Dummies Questions & Answers 3 07-20-2006 02:07 PM
Unix Date Command redsoxfan UNIX for Dummies Questions & Answers 1 03-24-2006 12:09 PM
unix date command niamh UNIX for Dummies Questions & Answers 1 04-09-2004 06:38 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-13-2006
Registered User
 

Join Date: Jan 2006
Location: Gandhinagar, India
Posts: 25
UNIX date command

Hello...I have have the value of date command stored in a particular format in a variable...Is there any way by which I can increment the value of the date using unix only?Until now i was calling an sql query to increment the date..

Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 02-13-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
Quote:
Originally Posted by tej.buch
particular format in a variable...Is there any way by which I can increment the value of the date using unix only?
What is the format ?

In general it is possible to increment the date.
Reply With Quote
  #3  
Old 02-13-2006
Registered User
 

Join Date: Jan 2006
Location: Gandhinagar, India
Posts: 25
date command

hi the format is YYYYMMDD.......

eg : today is
20060214
Reply With Quote
  #4  
Old 02-13-2006
Registered User
 

Join Date: Jan 2006
Location: Gandhinagar, India
Posts: 25
DATE query

well let me refine my query...

I have a set of dates in the format:
YYYYMMDD stored in a file...
what i do is read each value and increment the date in each..

till now i was calling an sql query to perform this task...

i searched the man pages and got the command
date --date="+1 day"
but the above command increments the date wrt to today's date..


my date may have any value...
so is there any command that can perform this operation..?
i dont want to invoke a shell script and would rather prefer a command ( if it exists)...........


thanks in advance......
Reply With Quote
  #5  
Old 02-15-2006
Registered User
 

Join Date: Feb 2006
Location: Southern England
Posts: 102
no easy way.

i'd use perl.

try the perl cookbook

perl CD
Reply With Quote
  #6  
Old 02-15-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,656
See the Date Arithmetic article in our FAQ section especially datecalc...

$ datecalc -a 2006 02 14 + 1
2006 2 15
$
Reply With Quote
  #7  
Old 02-16-2006
Registered User
 

Join Date: Jan 2006
Location: Gandhinagar, India
Posts: 25
date query

Yes..I had in fact lokked into the date calc script which is immensely useful for such calculations...but the problem is that that would entail an extra shell script in the package that is to be handed over to our clients and that i have been told to avoid ...If anyone comes across any single line command that would do the trick, kindly let me know............
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0