API Connect

API Connect

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.

 View Only
  • 1.  Getting datetime value with milliseconds in API Connect Gateway script

    Posted Wed July 12, 2023 03:03 PM

    Hi Team...

    I am using 'system.datetime' to get the gateway's time. The output of this function does not include milliseconds(6 digits). I need to get the time with milliseconds in the APIC gateway script assembly. Please let me know how this can be done. Thanks



    ------------------------------
    Ashok Beshra
    ------------------------------


  • 2.  RE: Getting datetime value with milliseconds in API Connect Gateway script

    Posted Wed July 12, 2023 03:58 PM

    Hi Ashok,
    Do you need your time in local time or UTC?  You're correct system.datetime doesn't have milliseconds, but system.datetime-utc does.

    These represent the times when the API started. You could get the .721 from the -utc time and concatenate it to the datetime value to get your local time with milliseconds when the transaction started.

    Best Regards,

    Steve Linn



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 3.  RE: Getting datetime value with milliseconds in API Connect Gateway script

    Posted Wed July 19, 2023 04:10 AM

    Thanks Steve, this worked. Is there a way to get 6 digits in milliseconds. Please advise



    ------------------------------
    Ashok Beshra
    ------------------------------



  • 4.  RE: Getting datetime value with milliseconds in API Connect Gateway script

    Posted Wed July 19, 2023 02:29 PM

    Hi Ashok,
    Not that I'm aware of, sorry.

    Best Regards,

    Steve Linn



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------