Question

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...

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top