Ben
Ben

Reputation: 566

Regex: match and replace on a date

I'd like to convert the date separators in a date.

So, from 11.11.2009 -> 11-11-2009

Could someone help me do that with a regex?

Upvotes: 2

Views: 658

Answers (2)

Murali VP
Murali VP

Reputation: 6417

You mean '11.11.2009'.replace(/\./g, '-').

Upvotes: 3

Richard Simões
Richard Simões

Reputation: 12801

my_date = my_date.replace(/\./g, '-');

Upvotes: 8

Related Questions