I want to get my dates into a format like this: 2010-10-01
How do I do this?
Also, I grabbed this from another question:
use (groovy.time.TimeCategory) {
Date date = Date.parse("dd-MMM-yyyy", "15-Mar-2011")
def months = (0..11).collect {
(date + it.months).format("MMM/yyyy")
}
}
How would I change the output of this script to the format I specified above? Thanks:)
In order to parse it out from a String:
In order to format the date that you already have:
EDIT (to answer the comment)
and backwards:
current date: