IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  Calculate Tomorrow Date

    Posted Thu May 17, 2007 03:43 PM

    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


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: Calculate Tomorrow Date

    Posted Thu May 17, 2007 05:53 PM

    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


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 3.  RE: Calculate Tomorrow Date

    Posted Thu May 17, 2007 06:31 PM

    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.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Calculate Tomorrow Date

    Posted Fri May 18, 2007 09:26 AM

    Thanks both!

    I’ve decided to import PSUtilites and use that.

    Sandro


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: Calculate Tomorrow Date

    Posted Fri May 18, 2007 03:27 PM

    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

    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB