Forum Discussion

VaniV28's avatar
VaniV28
Occasional Contributor
4 years ago
Solved

Error when using groovy script to tomorrow's date

Hi  I'm using the following script to get tomorrow's date use(groovy.time.TimeCategory) { def tomorrow = new Date() + 1.day //log.info tomorrow.format('yyyy-MM-dd\'T\'HH:mm:ssZ') return tomorr...
  • HimanshuTayal's avatar
    4 years ago

    You can use below code to get the desired result.

     

    import groovy.time.TimeCategory
    import java.text.SimpleDateFormat
    use(TimeCategory) {
    date = (new Date())+1.day
    sdf = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ssZ")
    newDate = sdf.format(date)
    log.info newDate
    }