0
私は軍用時間である24時間の時間を通常の12/12時間に変換する必要があります。私の変数をmoment.jsを使用して12/12時間形式に変換します
nextArrivalFinal2 = ((hour > 0 ? hour + ":" + (min < 10 ? "0" : "") : "") + min + ":" + (sec < 10 ? "0" : "") + sec);
console.log("nextArrival2", typeof nextArrivalFinal2)
console.log("nextArrival2", nextArrivalFinal2)
var convertedDate = moment(new Date(nextArrivalFinal2));
console.log('converted1', convertedDate)
console.log('converted', moment(convertedDate).format("hh:mm:ss"));
nextArrivalFinal2
HH:MM:ss
形式の文字列として時刻を表示します。しかし、それを瞬間jsに接続すると、それはinvalid date
だと言います。
あなたはなぜあなたは日付の詐欺を使用している、moment.jsを使用している場合、文字列を解析するための構造体?解析にはmoment.jsを使用します(フォーマットを教えてください)。 24時間形式は、軍以外の多くの組織や個人によって使用されています。 ;-) – RobG
'新しい日付(" 11:22:33 ")'は無効です。有効な日付には、日、月、年が含まれている必要があります。 – jagzviruz