我有一个包含用户加入日期的属性,并且以这种语法返回25-12-2018 10:31:33
,我只想从中获取日期,我尝试使用正则表达式,但无法弄清楚怎么做,有人可以帮忙吗?
No need of regex just split with space
and take 0 th index element.
let str = `25-12-2018 10:31:33` console.log(str.split(' ')[0])
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.