Adding time

i want to add 5 minutes or variable (settings.wakeUpIntervalInMins)

def nowtime = new Date().time
def nowtimeplus = nowtime + (settings.wakeUpIntervalInMins * 60)
log.debug "now = $nowtime, plus = $nowtimeplus, "

i can get this debug now = 1548954627027, plus = 1548954627327,
but when i try to format it ${nowtimeplus.format(“dd-MM-yy HH:mm”)} i get an error
could some one advise

Try this:

  def nowtime = now()
  def nowtimeplus = nowtime + (settings.wakeUpIntervalInMins * 60 * 1000)
  def nowtimeplusdate = new Date(nowtimeplus)
  log.debug "now = $nowtime, plus = $nowtimeplus, ${nowtimeplusdate.format('dd-MM-yy HH:mm',location.timeZone)}"

Something like this could also work for you:

def myDate = new Date(now())
log.debug "Now = ${myDate.format('dd-MM-yy HH:mm',location.timeZone)}"
myDate.set(minute:myDate.minutes+5)
log.debug "Later = ${myDate.format('dd-MM-yy HH:mm',location.timeZone)}"

worked thank you

def nowtime = now()
def nowtimeplus = nowtime + (settings.wakeUpIntervalInMins * 60 * 1000)
def nowtimeplusdate = new Date(nowtimeplus)
log.debug “now = nowtime, {now().format(“dd-MM-yy HH:mm”)} plus = nowtimeplus, {nowtimeplusdate.format(‘dd-MM-yy HH:mm’)}”