json date to javascript date

json date string comes like below.

“/Date(1238540400000)/”

While I was developing I wanted convert into javascript date and get date in “mm/dd/yyyy” format.

The I am using below function to get it done.


function parseJsonDate(jsonDateString) {

var date; var newDate;
if (jsonDateString) {
date = new Date(parseInt(jsonDateString.replace('/Date(', '')));
newDate = date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear();

 return newDate;
 }
}

I think this might help you….