views:

24

answers:

1
+1  Q: 

JS date converting

Hay, how can i turn a string like "04 Jan 2010" into a string like "1/4/2010". Can i do this with the JS date object?

Thanks

+3  A: 

Perhaps Date.parse() is what you're looking for?

If that doesn't do it, then Datejs adds more robust parsing.

Peter
This correctly converts the string into a stamp, now i need to convert the stamp back into a string, in PHP i would use date("D M Y", $stamp);Does js have something along those lines?
dotty
Thanks, this led to find the solution. Using a combination of getDate(), getYear(), and getDay().
dotty