[英]How to extract the time from the ISO8601 standard date format?
我有以下格式的日期字符串:2017-05-25T08:00:00.0000000 + 00:00
如何从ISO格式中提取hh:ss格式的时间?
由于严格定义了ISO8601,因此只需一个简单的substr
就可以了
console.log('2017-05-25T08:00:00.0000000+00:00'.substr(11,8));
您可以将正则表达式与.match()
方法一起使用:
var date = "2017-05-25T08:00:00.0000000+00:00"; console.log(date.match(/(\\d+:\\d+:\\d+)+/)[0])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.