Add minutes to current time in Jenkins pipeline (declarative syntax)

Viewed 5799

Jenkins pipeline code. Declarative syntax.

I need to get formatted date string for current datetime + 5 minutes. I can get formatted current datetime with this:

import java.text.SimpleDateFormat
def dateFormat
def date
def formattedDate
...
script {
    dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
    date = new Date()
    formattedDate = dateFormat.format(date)
}
echo formattedDate
...

How can i add 5 minutes to date? I've tried use TimeCategory or Calendar, but unsuccessfully

1 Answers
Related