Archive for October, 2022

Date Formatting in Groovy Script

October 13, 2022

We can format the date in groovy without importing the java simple date formats. Simply use like this :

String oldDate = '01/10/2022 13:48'
Date date = Date.parse( 'MM/dd/yyyy HH:mm', oldDate )
String newDate = date.format( 'yyyy-MM-dd' )

println newDate