Hello,
I want to get duration in days, when I try to calculate date duration between date 1 and date 2.
This is how I am trying to do:
def today = new Date().format('dd/MM/yy)
def calcDate = "13/06/18"
use(groovy.time.TimeCategory) {
def duration = today - calcDate
print "Days: ${duration.days}"
}
I get the error message, when I execute this script.
Reason:
groovy.lang.MissingPropertyException: No such property: days for class: java.lang.String
Possible solutions: class
I’ve also tried this instead of use()…
def summary = TimeCategory.minus(today, calcDate)
println summary
On this I got an error too :
Rreason:
groovy.lang.MissingMethodException: No signature of method: static groovy.time.TimeCategory.minus() is applicable for argument types: (java.lang.String, java.lang.String) values: [02/08/19, 13/06/18]