Adding or Subtracting Days from Current Date

You can use attached custom method to add\subtract specified number of days from current date. Place the attached class in customClasses folder and restart the server. The class has a exposed method getDate() that accepts a numeric input.

Enter the Number of days as input to this function. The function will return new date obtained by adding the specified number of days to the current date e.g. java:NextandPreviousDate.getDate(128 )

Note: You can also get the date obtained by subtracting the specified number of days from the current days. For this you need to provide the negative value to the function e.g. java:NextandPreviousDate.getDate(-128 )

Below is an example of adding 120 days to the current date.

datefunc_4638.jpg

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.