Add a new date to (+1 month)

Hi community,

I added today’s date to a new test case, so that today’s date can be entered in ‘Date from’.

But now I want to add a future date (1 month from now) to ‘Date to’.
Does anyone know, how I can do this?

You should no longer use java.util.Date class, which is too old, poorly designed.

You should use java.time.LocalDateTime and other classes available since Java 8. See

How to +1 month? — Java8 Date/Time API provides a straight forward answer to it :wink:

1 Like

@ruedigerl Try this post: How to add days & years to current date using 'java.time.LocalDateTime'

Hi this is not working form me, do you know why?

Date todaysDate = new Date();
def formatteddate = todaysDate.format("dd/MM/yyyy")
def futureDate =

WebUI.sendKeys(findTestObject('CURA Healthcare Service - Make Appointment/input_Visit Date'),futureDate)

What happens when you RTFM?

def futureDate ="dd/MM/yyyy")

Your “formatteddate” is cast to a String from a Date because you added the “format()” method, but your “futureDate” is still a Date because you haven’t added the “format()” method. The “sendKeys” method is expecting a String data type, so adding the “format()” method will cast the “futureDate” from a Date to a String.