ATokeley
15 years agoContributor
Converting Date string into Date
Hi guys,
I'm pulling my hair out trying to convert a string of format (2007-01-26T00:00:00) being returned in a REST response into a date format so I can operate on it and then re-use the value to perform a search.
def newdate = new Date().parse("d/M/yyyy H:m:s",lastDate)
I get the following :
groovy.lang.MissingMethodException: No signature of method: java.util.Date.parse() is applicable for argument types: (java.lang.String, groovy.util.slurpersupport.NodeChildren) values: [d/M/yyyy H:m:s, 2007-01-26T00:00:00] Possible solutions: parse(java.lang.String), parse(java.lang.String, java.lang.String), wait(), clone(), any(), use([Ljava.lang.Object;)
Cheers,
- Richard
I'm pulling my hair out trying to convert a string of format (2007-01-26T00:00:00) being returned in a REST response into a date format so I can operate on it and then re-use the value to perform a search.
def newdate = new Date().parse("d/M/yyyy H:m:s",lastDate)
I get the following :
groovy.lang.MissingMethodException: No signature of method: java.util.Date.parse() is applicable for argument types: (java.lang.String, groovy.util.slurpersupport.NodeChildren) values: [d/M/yyyy H:m:s, 2007-01-26T00:00:00] Possible solutions: parse(java.lang.String), parse(java.lang.String, java.lang.String), wait(), clone(), any(), use([Ljava.lang.Object;)
Cheers,
- Richard