📜  比较日期 javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:01.253000             🧑  作者: Mango

代码示例6
let myDate = new Date("January 13, 2021 12:00:00");
let yourDate = new Date("January 13, 2021 15:00:00");

if (myDate < yourDate) {
  console.log("myDate is less than yourDate"); // will be printed
}
if (myDate > yourDate) {
  console.log("myDate is greater than yourDate");
}