26. June 2013 10:52 by admin in
ASP.NET, JSON
Formatting JSON - style Javascript dates can be tricky. Here's some sample code that shows how to do it:
<!DOCTYPE HTML >
<html><head><script>
function formatDate( jsonDate)
{
var date = new Date(parseInt(jsonDate.substr(6)));
return date.getMonth()+'/'+date.getDay()+'/'+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes(); // 12/1/2013 13:46
}
</script></head><body>
<div id=dte><script>document.write(formatDate('/Date(1225243290011)/'));</script></div> </body>
</html>