Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Date in Java

Fri Oct 24, 2008 7:47 pm

How to add days to a particular date (say 8/31/2007) in Java? I am
aware of DATE and CALENDAR Objects in Java but not sure about methods.



Re: Date in Java

Fri Oct 24, 2008 7:50 pm

Date Arithmetic function. Adds the specified (signed) amount of time
to the given time field, based on the calendar's rules. For example,
to subtract 5 days from the current time of the calendar, you can
achieve it by calling:

add(Calendar.DATE, -5).

or to add 1 month to current date use this snippet

add(Calendar.MONTH,1)

Post a reply
  Related Posts  to : Date in Java
 Want start and end date of a month from current date     -  
 date formatting in Java     -  
 Formatting a Date with date()     -  
 get next date by next day     -  
 date validation in asp     -  
 How To Increment Date In JSP?     -  
 String to sql.Date     -  
 make class of date     -  
 Convert String to Date     -  
 Google indexing DATE     -  

Topic Tags

Java Time