convert time to UTC

Hi,

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.

Hi,

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.

Cheers!

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

https://gatling.io/docs/gatling/reference/current/session/expression_el/

I used these steps and It’s working now.

val utcString = OffsetDateTime.now(ZoneOffset.UTC)
“X-Request-Id” → (indxString+","+utcString),

Thank you!