We can use the format method with required formatter
Append with below 2 lines
def formattedDate = commitDate.format("yyyy-MM-dd'T'HH:mm:ss'Z'") log.warn("formattedDate=${formattedDate}")