Ask a Question

Date.Format failing after upgrading ReadyAPI to version 3.3.1

SOLVED
Karthik_K
New Contributor

Date.Format failing after upgrading ReadyAPI to version 3.3.1

After upgrading ReadyAPI to 3.3.1 from 3.3.0 the following Groovy script started failing with error "No signature of method: java.util.Date.format() is applicable for argument types: (String) values: [YYYY-MM-dd HH:mm:ss]". It dosen't like the .format of the date. Has the Groovy version got upgraded in version 3.3.1. Is there a quick solution for this issue?

 

/*Assertion Groovy Script */

"import groovy.time.TimeCategory
def now = new Date()
log.info now.format("YYYY-MM-dd HH:mm:ss")"

6 REPLIES 6
richie
Community Hero

Hey @Karthik_K

A number of people have found problems with their date handling in the latest version.

@nmrao suggested a possible fix for this in https://community.smartbear.com/t5/SoapUI-Pro/ReadyAPI-3-3-1-is-not-understanding-my-code-to-add-day...

Have a look and see if that sorts it,

Nice one,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
VishKini
Occasional Contributor

@richie : The above link is not working. Can you paste it again please?

apologies - unsure what happened - I certainly didn't edit the link when I copied it

 

 

https://community.smartbear.com/t5/SoapUI-Pro/ReadyAPI-3-3-1-is-not-understanding-my-code-to-add-day...

 

ta

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
tsuarezc
Occasional Contributor

I recommend using java.time.LocalDate class

https://howtodoinjava.com/java/date-time/java-time-localdate-class/

This works as well

"def lastUpdatedDateTimeUTC =  new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(lastUpdateDate)"

VishKini
Occasional Contributor

Thank you @tsuarezc , @richie !

cancel
Showing results for 
Search instead for 
Did you mean: