javascript extract date from string
function getDate(d)
{
var day, month, year;
result = d.match("[0-9]{2}([\-/ \.])[0-9]{2}[\-/ \.][0-9]{4}");
if(null != result) {
dateSplitted = result[0].split(result[1]);
day = dateSplitted[0];
month = dateSplitted[1];
year = dateSplitted[2];
}
result = d.match("[0-9]{4}([\-/ \.])[0-9]{2}[\-/ \.][0-9]{2}");
if(null != result) {
dateSplitted = result[0].split(result[1]);
day = dateSplitted[2];
month = dateSplitted[1];
year = dateSplitted[0];
}
if(month>12) {
aux = day;
day = month;
month = aux;
}
return year+"/"+month+"/"+day;
}
Also in JavaScript:
- facebook integration in node.js
- npm react native turn by turn navigation
- smooth scrolll to id js
- how to fix a vulnerability in expo
- simple express server
- deep clone array in javascript
- react redux
- abstraction in javascript
- javascript detectar la pagina
- express payloadtoolarge request entity too large bodyParser raw-body hydra-express
- install node js in manjaro
- appendchild element once if element present in js
- javascript floor
- sonarqube for angular application
- What is strict mode in Java Script ?
- jquery get data attribute value
- angular generat model
- code a space scene in js
- geoJson
- memoization javascript
- angular add bootstrap
- date difference
- javascript print int with leading zeros
- js query string