I would like to find date from java string.But i can not able to do this please help
String : 01-02-2014 <2>
Ineed output like :01-02-2014
My code:
public String rejex(String idate){
String result = null;
try{
String regex = "([1-9]|[012][0-9]|3[01])[-/]\\s*(0[1-9]|1[012])[-/]\\s*((19|20)?[0-9]{2})";
result = idate.replaceAll(regex, "$1-$2-$3");
}catch(Exception e){}
return result;
}