views:

34

answers:

2

I have a string

2010-08-02 12:13:06.0

and need to get something like

Fri Aug 6 2010

out of it (the input does not map to the output for the values I gave, just examples)

I fear Im going to have to do some string manipulation to get what I want; the js Date object does not seem to have methods capable of parsing the input string.

Is this correct?

We are using jquery, but cant find anything in that library that would help...

+2  A: 

Everything has been invented before us: http://www.mattkruse.com/javascript/date/

DmitryK
this seems to do the trick. I wanted to avoid bringing in other libraries, but I want to avoid reinventing the wheel more....this also confirms my suspicion that in sticking with the stock date functionality, I would need to do a lot of work...
hvgotcodes
A: 

You can use the date object for this. Just parse the first part of the date string to get the individual numbers and use setFullYear(), setMonth(), setDate(). You will have to subtract 1 from the month, but then use the toDateString() and it outputs it like your example. http://www.w3schools.com/jsref/jsref_obj_date.asp

qw3n