I have a date sting in the format as below: 2017-05-25T08:00:00.0000000+00:00
How to Extract the time in hh:ss format from the ISO format?
由于严格定义了ISO8601,因此只需一个简单的substr
就可以了
console.log('2017-05-25T08:00:00.0000000+00:00'.substr(11,8));
You can use a regular expression with .match()
method:
var date = "2017-05-25T08:00:00.0000000+00:00"; console.log(date.match(/(\\d+:\\d+:\\d+)+/)[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.