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

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

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

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

@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

@nmrao  yes it can be closed

Highlighted
Community Hero

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
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors