fafnir1990
fafnir1990

Reputation: 185

groovy parse date MissingMethodException

Hello I`ve a problem with function parse

package demo
Date d1 = new Date()
d1.parse("yyyy.MM.dd","2016.02.10")

Or another combination:

d= new Date().parse('dd.MM.yyyy',"2016.02.10").format('yyyy-MM-dd')

Both throw an exception:

groovy.lang.MissingMethodException: 
No signature of method: static demo.Date.parse() 
is applicable for argument types: (
java.lang.String, java.lang.String) 
values: [yyyy.MM.dd, 2016.02.10]

Could someone give me a hint?

Upvotes: 0

Views: 3780

Answers (1)

Vampire
Vampire

Reputation: 38669

Somehow you don't use java.util.Date but your own class demo.Date which of course does not have the parse method. Use java.util.Date instead and it will work.

Upvotes: 2

Related Questions