views:

60

answers:

3

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
My date returns /Date(1281067200000)/ when I would like to have something like 7/30/2010
+1  A: 

[UPDATED] Use dateJS:

SO thread

Edit: Try this: http://www.esqsoft.com/javascript_examples/date-to-epoch.htm

Jarek
This is what I am running into, but the "/Date()/" is messing up my conversion :(
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
You can remove unnecessary substrings:var formatDate = new Date("/Date(1281067200000)/".replace("/Date(", "").replace(")/", ""))
Jarek
I used a substring command then convert to number. Thanks alot for the help.
A: 

try this link JavaScript Date Format

rob waminal