• Post Reply Bookmark Topic Watch Topic
  • New Topic

get the next date in unix  RSS feed

 
yuga devi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any script or command to get the next date of the given date?

For ex , if i give YYYYMMDD - > 20090930,

It should give : 20091001


Please help.

---Yuga
 
yuga devi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Anyone can reply please. It is little emergency.

Thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://faq.javaranch.com/java/EaseUp

You want to do this with a script as in shell script?
For java, check out the Calendar/GregorianCalendar add and roll methods.
 
yuga devi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to get the code using shell script.
I have tried the following code:



but i am getting pervious date.

--Yuga
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12156
256
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't misuse color in your posts - if the code is all in red, then I don't want to read it. I have put your code between [code] and [/code] ubb code blocks.

You haven't specified which version of Unix you are using, or even if you are using the GNU date application.

If I were trying to achieve what you are asking for, and I had access to GNU date (default on Linux), then I would use:If I don't have access to GNU date, then I could always work it out for myself. Something like:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!