1
2
3
4
5
6
7
8
9
format = new java.text.SimpleDateFormat('yyyyMMddHHmmss')

def dateEx(delta, date = null) {
  d = (date) ? format.parse(date) : new Date()
  format.format(new Date(d.time + delta * 1000))
}

println dateEx(40, "20080827235925")
println dateEx(100)