Question: > 
> **Possible Duplicate:**  
> 
> [Format a Microsoft JSON date?](https://stackoverflow.com/questions/206384)
> 
> 
> 

The ASP.NET function `Json()` formats and returns a date as

```
{"d":"\/Date(1240718400000)\/"}

```

which has to be dealt with on the client side which is problematic. What are your suggestions for approaches to sending date values back and forth?

Answer: 
It may be ugly, but it works:

```
 var epoch = (new RegExp('/Date\\((-?[0-9]+)\\)/')).exec(d);
 $("#field").text((new Date(parseInt(epoch[1]))).toDateString());

```

Probably, it is not necessary to match the whole string, and just (-?[0-9]+) is enough...
Auto convert dates on the client side (if you use jQuery)

--

You didn't specify it, but since you're using [ASP.NET MVC](http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework) you could be using jQuery. If you do, converting to actual dates just became simpler if you use code provided on [this blog post](http://erraticdev.blogspot.com/2010/12/converting-dates-in-json-strings-using.html). The code extends jQuery's `$.parseJSON()` functionality, so it automatically converts ISO and ASP.NET date strings to actual JavaScript dates.

I use it with ASP.NET MVC, and it works like a charm. The best part is that it's also backwards compatible. Existing code that uses `$.parseJSON()` will work just like before (and actually work the same), but if you provide the second parameter and set its value to `true`, all dates will get automatically converted for you.

The extension uses native browser JSON support where applicable and also works in others that don't. Modern browsers support this functionality anyway.