Possible Duplicate:
Fastest method to replace all instances of a character in a string = Javascript
How to replace all points in a string in JavaScript
I have a string 2012/04/13
. I need to replace the /
with a -
. How can i do this ?
var dateV = '2012/04/13';
dateV= dateV.replace('/','-');
It only replaces the first /
and not all /
in the string (2012-04/13
). What should i do to correct this ?