I am using the below code to convert "Oct 09, 2018"
to "20181009"
.
import java.text.SimpleDateFormat
import java.util.Date
def olddate = "Oct 09, 2018"
def date = Date.parse( "MMM DD, yyyy", olddate )
def newDate = new SimpleDateFormat("yyyyMMdd").format(date)
The problem is that I get the below output:
20180109
Irrespective of what date I convert the code returns the month as January (01)