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

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
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
New 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
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

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors