我試圖用所有從今天開始且大于午夜的記錄來查詢資料庫。
var dateTime = moment().toDate()。
給了我當前的日期和時間。但有沒有辦法設定今天的午夜?
new Date(newDate()。 setHours(0, 0, 0, 0)
嘗試了上述方法,但仍然給我帶來了麻煩
2021-0911T18。 30: 00. 000Z
uj5u.com熱心網友回復:
怎么樣
moment()。 startOf('day')。toString()。
。
var now = moment(). startOf('day').toString()。
console.log(now);
<script src="https://cdnjs. cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/312000.html
標籤:
