Click here to Skip to main content
15,891,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I am trying to return a date from a asp.net webpage method and it returns me
/Date(1224043200000)/ I tried using the solution below using the DateFormat Library but It always returns a current date.

I think I am passing the correct parameters as mentioned in the solution, but still it only returns the current date.

http://stackoverflow.com/questions/206384/how-to-format-a-json-date

Hope some one can help me

Regards
Omer
Posted

1 solution

I was able to resolve it using the following solution below

result.d.dob is my input value /Date(1224043200000)/ and it returns a MM/dd/yyyy format.


JavaScript
var value = result.d.dob;
if (value.substring(0, 6) == "/Date(") {
   var dt = new Date(parseInt(value.substring(6, value.length - 2)));
   var dtString = (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
                     }

   $('#dob').val(dtString);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900