Showing results for 
Search instead for 
Did you mean: 

Ready API 3.3.1 - messed date up

Community Hero

Re: Ready API 3.3.1 - messed date up



Re: Ready API 3.3.1 - messed date up

@nmrao - Thanks for your time and patience in this date thing.  


I also wanted to note, that if anyone is just using the date and doesn't need anything to do with time you can use the following code:


${}  This will default to the format YYYY-MM-dd



if you use the "Import java.time.*" then you just need, otherwise will give the same format as above XML.


To use a different format you will need to setup a format variable or put it all together as @nmrao has shown previously.


This link helped me play around and get it working:


Hope this helps. Good luck!  😉

Occasional Contributor

Re: Ready API 3.3.1 - messed date up

a piece of code in groovy which was working fine up to ReadyAPI version 3.2.5

Once I have updated the version, the format () function stopped working.

Can anyone suggest how I can manipulate the date? Like, I want a random date after 6 months from today.


Upto ReadyAPI 3.2.5 I have used - 

use(TimeCategory) {
def date = (today + (new Random().nextInt(12)).months).format(yyyy-MM-DD).toString());


But the format () function not working in ReadyAPi 3.3.1. Any leads would be appreciated.


Thanks in advance!

Frequent Contributor

Re: Ready API 3.3.1 - messed date up

Hi @API_Guy 


Can you please try below snippet


import groovy.time.TimeCategory
import java.text.SimpleDateFormat


use(TimeCategory) {
date = ((new Date() + (new Random().nextInt(12)).months))
sdf = new SimpleDateFormat("yyyy-MM-dd")
newDate = sdf.format(date)




Occasional Contributor

Re: Ready API 3.3.1 - messed date up

Thanks much, @PrathapR.

It worked for me and it was a great help! thanks again.

@khanchett this is how you can manipulate the date by adding or subtracting a day/month as well

date = ((new Date() +  3.months). you can give a try. It worked for me.

Regular Visitor

Re: Ready API 3.3.1 - messed date up

Hi Smart Bear Team ,




 Thanks for this Solution but this solution works only when we change the Script and it is very difficult to change every script in each and every Automation Pack let say suppose  60 Automation pack  around 30 Script in Generate Test Data and Grooy script 


That would be very very difficult to change the script to fix this issue 

So we want proper solution like in change in Jar file or some classes change so it should be one time change / one time activity  to fix this issue


we are using Pro Version and need it to fix other wise we wont be able to continue to next level of version 



Tags (1)
Occasional Contributor

Re: Ready API 3.3.1 - messed date up


FYI, I faced same issue with version 3.3.1, but this problem has been fix in version 3.4.0


The java.util.Date class didn't function properly in Groovy scripts since ReadyAPI 3.3.1 (RIA-14157)



New Here?
Join us and watch the welcome video:
Top Kudoed Authors