Forum Discussion

senthkum's avatar
senthkum
Contributor
5 years ago
Solved

Convert string date to date format?

Spoiler
 

Hi Team,

I need to convert the string date to date format. So, I can do a datediff, which is little urgent for me to fix this.

Based on the datediff I need to send the response.

The below code is not working.

 

def getDate = "2020-02-12T00:00:00.000+11:00"
def getFormat = "yyyy-MM-dd"
def dDate = new Date().parse(getFormat, getDate)
def getdDate = dDate.format(getFormat)
log.info getdDate

def today = new Date()
log.info today.format("yyyy-MM-dd")
log.info today - getdDate

 

Thanks

Senthil. M