Calculate Tomorrow Date

Hi All,
I need to calculate the tomorrow date (only date, not time).

Is there a better way than using Java service and play with milliseconds?

Regards,
Sandro

I recommend using the GregorianCalendar class.

It will look something like:

java.util.GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(new java.util.Date()); //sets the calendar to today
calendar.add(calendar.DAY_OF_YEAR,1); //1 is the number of days to add
// negatives go backward
Date tomorrow = calendar.getTime();

!!!
-greg

Take a look at PSUtilities.date:incrementDate.

Alternatively, depending on what data you have readily available and in what format, you may be able to use a combination of pub.math:addInts and pub.date:dateTimeBuild.

Thanks both!

I’ve decided to import PSUtilites and use that.

Sandro

Sandro,

Just a little note on “best practices”: if you need to use a service from one of the utilities packages (ex. PSUtilities, WmSamples, etc.), it is usually recommended that you copy the service into your own utilities package and modify it so it meets your coding standards and conventions. It is generally not recommended to deploy PSUtilities, WmSamples, etc. to environments other than Development.

  • Percio