1function getDate(d)
2{
3 var day, month, year;
4
5 result = d.match("[0-9]{2}([\-/ \.])[0-9]{2}[\-/ \.][0-9]{4}");
6 if(null != result) {
7 dateSplitted = result[0].split(result[1]);
8 day = dateSplitted[0];
9 month = dateSplitted[1];
10 year = dateSplitted[2];
11 }
12 result = d.match("[0-9]{4}([\-/ \.])[0-9]{2}[\-/ \.][0-9]{2}");
13 if(null != result) {
14 dateSplitted = result[0].split(result[1]);
15 day = dateSplitted[2];
16 month = dateSplitted[1];
17 year = dateSplitted[0];
18 }
19
20 if(month>12) {
21 aux = day;
22 day = month;
23 month = aux;
24 }
25
26 return year+"/"+month+"/"+day;
27}