Page 1 of 1 [ 3 posts ] 

JakeGrover
Sea Gull
Sea Gull

User avatar

Joined: 21 May 2010
Age: 26
Gender: Male
Posts: 221
Location: Vermont, USA

12 Nov 2010, 5:48 pm

var date = "10.28.2008";
var replaceRegex = /\./g;


date.replace(replaceRegex, "/");

alert(date);

Shouldn't the alert say "10/28/2008"? It doesn't seem to be doing that.



CloudWalker
Veteran
Veteran

User avatar

Joined: 26 Mar 2009
Age: 34
Gender: Male
Posts: 711

12 Nov 2010, 6:16 pm

You need to store the output:
date = date.replace(replaceRegex, "/");



JakeGrover
Sea Gull
Sea Gull

User avatar

Joined: 21 May 2010
Age: 26
Gender: Male
Posts: 221
Location: Vermont, USA

12 Nov 2010, 7:59 pm

Okay, thanks. 8)