convert time to UTC


Can anyone please let me know, how to convert val utcString = System.currentTimeMillis() to UTC Timezone in Gating?

something looking in this format: 2021-07-14T17:18:52Z

which is ISO 8601.

Thank you in advance.


Use any suitable JVM library.
You can use the standard java.time API.
Specifically: ZonedDateTime seems to suit your needs.

Note: this is not specific to gatling usage.


If you’re using Gatling EL, there’s also a built in function: currentDate()

I used these steps and It’s working now.

val utcString =
“X-Request-Id” → (indxString+","+utcString),

Thank you!