第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何使用 java 腳本將 12 小時(shí)日期時(shí)間格式轉(zhuǎn)換為 24 小時(shí)格式?

如何使用 java 腳本將 12 小時(shí)日期時(shí)間格式轉(zhuǎn)換為 24 小時(shí)格式?

慕運(yùn)維8079593 2021-12-02 14:51:06
我以 24 小時(shí)格式從我的數(shù)據(jù)庫(kù)發(fā)送數(shù)據(jù),但是當(dāng)我在前端使用它作為時(shí)間計(jì)數(shù)器時(shí),輸出給出“無(wú)”。此外,當(dāng)我打印“plan_deactive_date”時(shí),它以 12 小時(shí)格式顯示時(shí)間。那么,有沒(méi)有辦法將日期時(shí)間從 12 小時(shí)格式轉(zhuǎn)換為 24 小時(shí)格式?<script>// Set the date we're counting down tovar countDownDate = new Date("{{plan_deactive_date}}").getTime();// Update the count down every 1 secondvar x = setInterval(function() {  // Get today's date and time  var now = new Date().getTime();  // Find the distance between now and the count down date  var distance = countDownDate - now;  // Time calculations for days, hours, minutes and seconds  var days = Math.floor(distance / (1000 * 60 * 60 * 24));  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));  var seconds = Math.floor((distance % (1000 * 60)) / 1000);  // Display the result in the element with id="demo"  document.getElementById("demo").innerHTML = days + "d " + hours + "h "  + minutes + "m " + seconds + "s ";  // If the count down is finished, write some text  if (distance < 0) {    clearInterval(x);    document.getElementById("demo").innerHTML = "Expired";  }}, 1000);</script>
查看完整描述

2 回答

?
蝴蝶不菲

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊

您可以使用

date.toLocaleDateString('en-GB')

讀這個(gè):

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date


查看完整回答
反對(duì) 回復(fù) 2021-12-02
?
郎朗坤

TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊

您可以使用

  1. 24小時(shí)格式獲取日期

    • data.toLocaleString('en-GB')

  2. 12小時(shí)格式獲取日期

    • data.toLocaleString('en')


查看完整回答
反對(duì) 回復(fù) 2021-12-02
  • 2 回答
  • 0 關(guān)注
  • 380 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)