I would like to create a method which takes input as Date
and check what is the format of it or whether it is matching with particular format.
myMethod(Date date){
String format = "yyyy-MM-dd";
//Here I would like to compare that 'date' is in the required format
}
Here, I should accept Date
type only not String
type.