datatables - Database datetime format in Javascript -


i use datatables.net plugin jquery build grid.

i need output column date. database this:

{ts '2013-05-04 03:21:12'} 

i output 04-05-2013

split string , rearrange it.

var ts = "{ts '2013-05-04 03:21:12'}"; ts = ts.match(/'([^']+)'/)[1];  // or ts.split("'")[1] var dt = ts.split(" "); var date = dt[0]; var datesplit = date.split("-"); var finaldate = datesplit[2] + "-" + datesplit[1] + "-" + datesplit[0]; 

this assuming timestamp in format provided (won't have other numbers/characters or in different order).

demo: http://jsfiddle.net/gqthr/1/


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -