cancel
Showing results for 
Search instead for 
Did you mean: 

ReadyAPI 3.3.1 is not understanding my code to add days to a date (version 3.1.0 did!)

SOLVED
Highlighted
New Contributor

ReadyAPI 3.3.1 is not understanding my code to add days to a date (version 3.1.0 did!)

with version 3.1.0 this was working perfectly in XML request (adding 10 days to systemdate):

 

<ZKN:einddatumGepland>${=new java.text.SimpleDateFormat("yyyyMMdd").format(new java.util.Date()+10)}</ZKN:einddatumGepland>

 

with version 3.3.1 the date-value is not added to the XML. Instead some error text is added:

 

No signature of method: java.util.Date.plus() is applicable for argument types: (Integer) values: [10] Possible solutions: parse(java.lang.String), split(groovy.lang.Closure), is(java.lang.Object), use([Ljava.lang.Object;), wait(),

 

What's changed or what am i missing?

 

Kind regards,

Maarten Rutten

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: ReadyAPI 3.3.1 is not understanding my code to add days to a date (version 3.1.0 did!)

Because of java update in 3.3.1

Use
<ZKN:einddatumGepland>${= java.time.LocalDateTime.now().plusDays(10).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"))}</ZKN:einddatumGepland>


Regards,
Rao.

View solution in original post

3 REPLIES 3
Highlighted
Community Manager

Re: ReadyAPI 3.3.1 is not understanding my code to add days to a date (version 3.1.1 did!)

Thank you for posting your question @MRutten!

 

@HimanshuTayal @richie @nmrao , what do you think might be causing this?🙂


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

Re: ReadyAPI 3.3.1 is not understanding my code to add days to a date (version 3.1.0 did!)

Because of java update in 3.3.1

Use
<ZKN:einddatumGepland>${= java.time.LocalDateTime.now().plusDays(10).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"))}</ZKN:einddatumGepland>


Regards,
Rao.

View solution in original post

Highlighted
Occasional Contributor

Re: ReadyAPI 3.3.1 is not understanding my code to add days to a date (version 3.1.0 did!)

I recommend using java.time.LocalDate class

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

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