how to add days to java simple date format -


How do I add 120 days to my current date, which is to use simple date format?

I

  has seen some posts about SimpleDateFormat dateFormat = New SimpleDateFormat ("dd / MM / yyyy") but it could not work,  

); // Get the current date time with date () date = date new date ();

Do I need to use the calendar library or can I do this with a normal date format?

calendar , which will automatically roll the different areas of the date based on the changes Has potential. Single field, for example ...

  calendar cal = Calendar.getInstance (); Cal.setTime (date); Cal.add (calendar.date, 120); Date = cal.getTime ();  

Look closely for a more information.

Yes, this is a method using add time, but I can type this example quickly;)

Update with JodaTime Example

An example is using the following. You can parse the string value using jodaTime directly, but since you have already done so, I did not bother ...

  date = ...; Date time DT = New date time (date); Dt = dt.plusDays (120); Date = dt.to date ();  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -