Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

add days to date

 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is there any simple way to add to a Date object 3 days.

I trie to get the milisecons from the date and then create a new date with the miliseconds from the original date adding the miliseconds of threee day but I think there would be something easier.

Thnaks
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Use Calendar class, It has roll() and add() methods , which helps to add() specific field by some value you want. The fields are like DATE, MONTH , etc..

Have look at Calendar class APIfor detailed story !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic