I am working on a project and I want to create a script field to calculate the days elapsed up to the current date.
class Ejemplo {
public static void main(String[] args) {
def lastWeek = new Date() - 7;
def today = new Date()
println daysBetween(lastWeek, today)
}
static def daysBetween(def startDate, def currentDate) {
use(groovy.time.TimeCategory) {
def duration = currentDate - startDate
println "days: ${duration.days}"
return duration.days
}
}
}
I have advanced up here but I find myself stuck, I appreciate any help