简体   繁体   中英

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?

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

你的意思是'11.11.2009'.replace(/\\./g, '-')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM