Convert MySql Dates to localized dates


/ Published in: JavaScript
Save to your folder(s)

Will convert all of the mysql dates on the page to be localized.


Copy this code and paste it in your HTML
  1. // javascript:document.body.innerHTML%20=%20document.body.innerHTML.replace(/(\d{4})-(\d{2})-(\d{2})/ig,function(match,year,month,day){return%20(new%20Date(year,month,day).toLocaleString())%20});
  2. document.body.innerHTML = document.body.innerHTML.replace(/(\d{4})-(\d{2})-(\d{2})/ig,function(match,year,month,day){return (new Date(year,month,day).toLocaleString()) });

URL: javascript:document.body.innerHTML%20=%20document.body.innerHTML.replace(/(\d{4})-(\d{2})-(\d{2})/ig,function(match,year,month,day){return%20(new%20Date(year,month,day).toLocaleString())%20});

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.