groovy next() date issue

Viewed 1628

I am trying to add a groovy script in SoapUI to find tomorrow's date using next() in current date. I am getting the date as expected for all other dates except if the date is 19.

def TodaysDate = new java.util.Date().format("yyyy-MM-dd")
log.info ">>>>>>>>>> TodaysDate="+TodaysDate
log.info TodaysDate.next()

Output:

Wed Jul 19 14:34:29 EDT 2017:INFO:>>>>>>>>>> TodaysDate=2017-07-19
Wed Jul 19 14:34:29 EDT 2017:INFO:2017-07-1:

I tried this also.

def Today = new java.text.SimpleDateFormat("yyyy-MM-dd").format(new Date())
log.info Today
NextDay = Today.next()
log.info NextDay 

Output:

Wed Jul 19 14:43:38 EDT 2017:INFO:2017-07-19
Wed Jul 19 14:43:38 EDT 2017:INFO:2017-07-1:

This next() iterator works fine for other dates. Can you help me understand what I am doing incorrect here?

2 Answers
Related