簡體   English   中英

hh:mm:ss.sss無法被Date.parse()識別

[英]hh:mm:ss.sss not recognised by Date.parse()

我正在嘗試使用以下函數將時間字符串callLength轉換為毫秒,但返回值為NaN

你能看到我哪里出問題了嗎? 提前致謝。

export const timeFunc = callLength => {
  console.log(callLength); // prints "00:00:32.000"
  const startingTime = Date.parse('1970-01-01T00:' + callLength + 'Z') // should print length in milliseconds?
  console.log(startingTime); // prints NaN
}

您要加班兩次。

Date.parse('1970-01-01T00:' + "00:00:32.000" + 'Z')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM