[英]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.