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
Expand all | Collapse all

Calculate date base on input date and minutes or hour difference

  • 1.  Calculate date base on input date and minutes or hour difference

    Posted Thu July 16, 2020 03:13 AM

    Hello webMethods Expert,

    I am trying to build a service which to scan all the transaction for the past 1 hour or 30 minutes until now.
    Basically for this service i have 2 inputs:

    • start_date = last 1 hour or 30 minutes from now
    • end_date = current date time

    For the “end_date”, i can use: pub.date:getCurrentDateString
    But i am still doubt, how can i construct “start_date” which is current datetime minus 1 hour or 30 minutes from now?

    I don’t think the service pub.date:calculateDateDifference can do this either.

    Any idea on built in services to construct the “start_date”?

    Appreciate any help.

    Thank you,
    Fanny T


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


  • 2.  RE: Calculate date base on input date and minutes or hour difference

    Posted Thu July 16, 2020 03:51 AM

    Hi,

    You should look into the “webMethods Integration Server Built-In Services Reference” manual.

    pub.datetime:increment

    WmPublic - Increments or decrements a date and time by a specified amount of time.

    Happy coding.


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


  • 3.  RE: Calculate date base on input date and minutes or hour difference

    Posted Thu July 16, 2020 06:00 AM

    Hi Gerardo,

    Looks like i am still referring to the Software AG built in Services Reference Version 9.5 SP1.
    I don’t see the incrementDate in this document.

    Since i am using Version 10.3, i can see this service in WmPublic.
    pub.date:incrementDate.

    Many thanks for pointing this service.

    Best Regards,
    Fanny T


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


  • 4.  RE: Calculate date base on input date and minutes or hour difference

    Posted Sun July 26, 2020 10:02 PM

    Hi,
    There are a few steps to build a flow service which you may need, like below:

    1. build a service with
      service Input = minutes_offset
      service output = start_date, end_date

    2. invoke pub.date:getCurrentDate

    3. invoke pub.date:formatDate, to get yyyy(year), MM(month), dd(day), HH(hour), mm(mins)

    4. invoke pub.math:addInts, add mm with minutes_offset (30mins or 60 mins)

    5. invoke pub.date:formatDate to get end_date, pattern = yyyy-MM-dd HH:mm

    6. invoke pub.date:dateTimeBuild to get start_date, pattern = yyyy-MM-dd HH:mm


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