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

**URL:** <https://community.gatling.io/t/how-to-integrate-the-value-of-a-variable-in-the-body-of-a-post-request-in-gatling-with-scala/7344>\
**Category:** Gatling (Open-Source)\
**Created:** [November 26, 2022, 7:40pm UTC](https://community.gatling.io/t/how-to-integrate-the-value-of-a-variable-in-the-body-of-a-post-request-in-gatling-with-scala/7344 "2022-11-26T19:40:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Imane](https://avatars.discourse-cdn.com/v4/letter/i/977dab/32.png) [@Imane](https://community.gatling.io/u/Imane)\
**Post date:** [November 26, 2022, 7:40pm UTC](https://community.gatling.io/t/how-to-integrate-the-value-of-a-variable-in-the-body-of-a-post-request-in-gatling-with-scala/7344/1 "2022-11-26T19:40:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [November 27, 2022, 5:15am UTC](https://community.gatling.io/t/how-to-integrate-the-value-of-a-variable-in-the-body-of-a-post-request-in-gatling-with-scala/7344/2 "2022-11-27T05:15:44Z")

</div>

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](https://gatling.io/docs/gatling/reference/current/core/session/el/#built-in-functions), such as `currentTimeMillis()` or `currentDate(<pattern>)` .

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [December 27, 2022, 5:16am UTC](https://community.gatling.io/t/how-to-integrate-the-value-of-a-variable-in-the-body-of-a-post-request-in-gatling-with-scala/7344/3 "2022-12-27T05:16:16Z")

</div>

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