Forum Discussion

ilovechiku's avatar
ilovechiku
Contributor
10 years ago
Solved

Parsing a date in groovy.

I have a response with a date just like this 

BirthDate": "1972-02-12T00:00:00"

 

i want to get to date like this 02/12/1972

 

How can i do that?.

So far I have tried

 

def bday =jsonResponse.Demographics.BirthDate
log.info "bday"+bday
def formatter = new SimpleDateFormat();
Date date = formatter.parse(bday);

 

am getting a error saying "unparseable date"

 

can anyone help