nmrao
8 years agoCommunity Hero
Re: adding hours to the present date with groovy
MD01,
Here your go:
Looks like this is your question in Stackoverflow which happened to answer there already.
It would be easy if you use time category as shown below.
use(groovy.time.TimeCategory) {
def halfHourFromNow = new Date() + 2.hour
log.info halfHourFromNow.format("yyyy-MM-dd HH:mm:ss")
}
You can quickly check it online demo