How to integrate the value of a variable in the body of a post request in gatling with scala

I want to use the value of a variable in the body of my post request , but I don’t know how can I do because I already use a csv file as feeder to get all the other value for query’s parameter, expect one parameter that should have as value current time :
Var currentTime = ZonedDateTime.now()
and then in body of post request I have
.body(
StringBody(“”"{
keys: value gotten from csv file

timeNow: ( here I want to put the value of my variable currentTime)

}“”")
How can I integrate the value of my variable Currentime as a value of the body query’s parameter , thank you
I m using Scala as language

You’ve doubled posted on StackOverFlow, so I’m copying my answer here too:

Easiest way: use one of the built-in Gatling Expression Language functions, such as currentTimeMillis() or currentDate(<pattern>) .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.