I have a date that I would like to convert to String format. /Date(1281067200000)/ is supposed to be 08/06/2010 12:00:00:00. How do I convert /Date(1281067200000)/ to 8/6/2010?
A:
What type of string format? You could use yourDate.toString()
or yourDate.toLocaleDateString()
depending on your use case.
balupton
2010-08-11 12:45:40
My date returns /Date(1281067200000)/ when I would like to have something like 7/30/2010
2010-08-11 13:03:59
+1
A:
[UPDATED] Use dateJS:
Edit: Try this: http://www.esqsoft.com/javascript_examples/date-to-epoch.htm
Jarek
2010-08-11 12:46:21
This is what I am running into, but the "/Date()/" is messing up my conversion :(
2010-08-11 14:32:12
I did some testing... var formatDate = new Date(1281067200000) is what I am looking for. Is there a way to use this "/Date(1281067200000)/" and add to make the conversion
2010-08-11 14:38:03
You can remove unnecessary substrings:var formatDate = new Date("/Date(1281067200000)/".replace("/Date(", "").replace(")/", ""))
Jarek
2010-08-11 14:57:06