How to convert date to string in Groovy

1 Answer

0 votes
Date d1 = new Date()
Date d2 = new Date("12/10/2020")

println d1.toString()
println d2.toString()

 
 
     
/*
run:
      
Tue Oct 06 09:24:56 GMT 2020
Thu Dec 10 00:00:00 GMT 2020
      
*/

 



answered Oct 6, 2020 by avibootz
...