js正则表达式格式化日期

var date = "2015-11-11 00:00:00";

var newDate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(date)

newDate="2015-11-11";
发布了37 篇原创文章 · 获赞 10 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_38404507/article/details/102914236