cancel
Showing results for 
Search instead for 
Did you mean: 

Convert string date to date format?

SOLVED
Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Convert string date to date format?

1 REPLY 1
Highlighted
Community Hero

Re: Convert string date to date format?