Current time in milliseconds

Tagged: ,

This topic has 4 replies, 2 voices, and was last updated 4 years ago by Dusty.

  • Author
  • #22671


    What is the best way to get the current time in milliseconds in a route? I know I could do it with a Scriptable Filter, but It feels like killing a fly with a sledgehammer. I’m using IG 6.1.




    You can use the TimerDecorator (See
    It record time in milliseconds to process filters and handlers. In your case, add "timer": true under your route condition.



    Hi Violette,

    Thanks for your help. I already saw the TimerDecorator, but I thought it was only for timing filters, handers,… The documentation is very basic for the decorators. How can I use the current time in an expression, for example

        "type": "HeaderFilter",
        "config": {
            "messageType": "REQUEST",
            "add": {
                "x-currenttime": [
        "timer": true,
    • This reply was modified 4 years ago by Dusty.


    Sorry, I misunderstood. I thought you wanted the elapsed time in a route but you do want to get the current system time and send it to the downstream application.
    Yes, for that the TimerDecorator won’t be helpful… If you want to use expression, you will have to set env variables or system variables to retrieve the datetime. ({env['variable']}, and ${system['property']}.).
    As far as I know, there is no other way to get the current time using expressions.
    A groovy script is an alternative too.


    Hi Viollete,

    This is indeed what I meant. I want to create a JWT token with the JWTTokenBuilder and add an expiry date to that token. I think I will go for the groovy script.

    Thank you for your help!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?