javascript - HTML&CSS Change Date Formatting On Whole Web Page -


i working on portlet used multiple users throughout world, therefore change basic date format of on html page default dd/mmm/yy where mmm abbreviation because default confusing depending of country (aka usa or somewhere else)

aka 05/05/2014 should show 05/may/14 , 06/08/2015 should show 06/aug/15 

since of dates need written way, maybe it's line of code in css or html file? looked around , couldn't find abbreviated dates, therefore i'd rather directly ask professionals.

i wrap dates in <time> element, use javascript convert local date format.

html:

published <time datetime="2011-07-03">07/03</time> 

js:

var elements = document.getelementsbytagname("time"); (var i=0; i<elements.length; i++) {     var dat = new date('utc:'+elements[i].getattribute('datetime'));     elements[i].innerhtml = dat.tolocaledatestring(); } 

http://jsfiddle.net/mblase75/7yf5v/


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -