问题
I am trying to subtract 10 minutes from the current time, but I cant find the proper syntax in the documentation I have looked up
I have this so far
def deltaMinutes = 10
use(TimeCategory) {
def nowTime = new Date() - deltaMinutes.minutes
log.debug nowTime
}
and get this in the SmartThings IDE
java.lang.NullPointerException @ line 53
Perhaps the IDE doesnt support this library? What would be the next best method for calculating this?
回答1:
10.minutes.ago
should give what you are looking for
use( groovy.time.TimeCategory ) {
println 10.minutes.ago
}
来源:https://stackoverflow.com/questions/25046910/how-do-i-subtract-minutes-from-current-time