Forum Discussion

Deepika_Lalam's avatar
Deepika_Lalam
Regular Visitor
5 years ago

Add minutes to current date time using groovy

To get the Current Date Time value, im using this: ${= Calendar.getInstance(TimeZone.getTimeZone('GMT')).format("yyyy-MM-dd'T'HH:mm:ss")} which gives DateTime as 2020-02-05T22:07:34   I want to a...
  • nmrao's avatar
    5 years ago

    Deepika_Lalam 

    With Java 8, below should get you the time you needed in one liner

     

    ${= java.time.ZonedDateTime.now(java.time.ZoneId.of("GMT")).plusMinutes(40).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))}