aspose file tools*
The moose likes JDBC and the fly likes increment date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "increment date" Watch "increment date" New topic
Author

increment date

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi all,

thanks for all quick replies..

i am doing library project and want to increment date
that is from the issue date , i want to add 14 and get
return date for a book. i donot want to write to oracle
and use oracle commands for increasing date and again updating same record.
is there any built in function for so???

regards
srijan
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
You might want to look at what GregorianCalendar can do for you. The basic constrictor creates a GregorianCalendar object to today and the roll method can increment the date a specific amount af time. The only draw back is formatting the date that it creates into something usable. But, with the help of the get method GregorianCalendar provides and DecimalFormat you should be on your way.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Jesse Tilly
Ranch Hand

Joined: Jun 25, 2000
Posts: 37
There is a "bulldog" method. Take n, multiply by 86400000 (# of milliseconds in a day). Add to the long rep of the date, make new date with new value. You have now added n days to the date.
Jesse
 
Consider Paul's rocket mass heater.
 
subject: increment date