I’m trying to convert a timestamp made by
var now = new Date().getTime();
which creates the timestamp 1349916512100.
I want the date to be formatted like
\/Date(1349916512100)\/
to be used in a JSON string, right now I’m just concatonating the \/Date and \/, (like the example above) but is there a better/proper way to do this?
Short answer: not really. There are other ways, but what you’re doing is probably the simplest way.
There’s an interesting article on the subject here, but what’s being described is more academic than practical.