• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

increment date  RSS feed

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!