Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 2
Next »
ISO formatted date
import java.text.SimpleDateFormat
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd")
def today = format.format( new Date() )
RFC3339 date
import java.text.SimpleDateFormat
//2020-10-03T10:00:00Z
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
def today = format.format( new Date() )
Add / subtract time
Add 10 minutes
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
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)