Forum Discussion

mgroen2's avatar
mgroen2
Super Contributor
6 years ago

get current date and time and put it in the body of a request (json)

I need to send a request populated with current date and time in the body as Json. In this format: "DatumtijdOndertekening": "${__time(yyyy-MM-dd'T'hh:mm:ssX)}" What do I need to get this work...
  • nmrao's avatar
    6 years ago

    If you are using jdk 8, below should work.

     

    You almost there, its trivial.

    {
       "DatumtijdOndertekening" : "${= java.time.OffsetDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ssZ'))}"
    }