Sunday, July 8, 2012
Using Groovy to set a Date using java.util.Calendar.Date
Here is one way to set the java.util.Calendar.Date in Groovy...
------------------------------------------------------
import static java.util.Calendar.*
String year = "2009";
String month = "6";
String day = "1";
def aGCdate = new GregorianCalendar(Integer.parseInt(year),
Integer.parseInt(month) - 1,
Integer.parseInt(day))
println aGCdate.getTime()
def mil = new Date(aGCdate.getTimeInMillis())
println mil
---------------------------------------------------------------
Test it with the Groovy Console here...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment