Monday, May 14, 2012

Whats in Groovy

Get today's date in your desired format.


def today = Calendar.getInstance()
def todayFormatted = String.format('%tm/%<td/%<tY', today)
println todayFormatted


Run the Groovy Console, you will see the date as 05/15/2012 (of course if would be current date)