cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Super Contributor

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 working?

 

Thanks,
Mathijs

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

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

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'))}"
}

 



Regards,
Rao.

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

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

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'))}"
}

 



Regards,
Rao.

View solution in original post

Highlighted
Super Contributor

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

Hi @nmrao ,

 

thanks a lot for your reaction. It worked!

 

Strange thing is, I don't have any Java installed on the machine (Windows-> Control Panel-> Programs and Features doesnt display any Java client installed).

You have an explanation?

 

Highlighted
Community Hero

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

@mgroen2,
Nice to know that it worked. Can this be closed then?

Though you don't install java, JRE gets shipped along with SoapUI installation.


Regards,
Rao.
Highlighted
Super Contributor

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

@nmrao  yes it can be closed

Highlighted
Community Hero

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

Thanks, appreciate it.
But changed the solution to the actual one which solves the main issue.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors