JSFiddle - React, Tailwind, and code Playground
HTML
<button id="formateDateBtn">
Formate Date : 25/03/2015
</button>
<div>
Formated Date: <span id="formatedDate"></span>
</div>
JavaScript
function formateDateToUK(dateString){
var splitDate = dateString.split('/'),
day = splitDate[0],
month = splitDate[1] - 1, //Javascript months are 0-11
year = splitDate[2],
formatedDate = new Date(year, month, day);
return formatedDate;
}
document.getElementById("formateDateBtn").addEventListener('click', function(){
document.getElementById("formatedDate").innerHTML = formateDateToUK("25/03/2015");
});