开发者

Regex: match and replace on a date

开发者 https://www.devze.com 2022-12-10 23:47 出处:网络
I\'d like to convert the date separators in a date. So, from 11.11.2009 -> 11-11-2009 Could so开发者_如何学Cmeone help me do that with a regex?my_date = my_date.replace(/\\./g, \'-\');

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

So, from 11.11.2009 -> 11-11-2009

Could so开发者_如何学Cmeone help me do that with a regex?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消