Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleAdd / subtract time

Add 10 minutes

Code Block
import java.text.SimpleDateFormat
import groovy.time.TimeCategory

//2020-10-03T10:00:00Z
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
def currentDate = new Date()
def after30Mins
use( TimeCategory ) {
    after30Mins = currentDate + 10.minutes
}
def today = format.format(after30Mins)

Subtract 10 minutes

Code Block
import java.text.SimpleDateFormat
import groovy.time.TimeCategory

//2020-10-03T10:00:00Z
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
def currentDate = new Date()
def after30Mins
use( TimeCategory ) {
    after30Mins = currentDate - 10.minutes
}
def today = format.format(after30Mins)

more options on time are: