📜  比较javascript代码示例中的日期

📅  最后修改于: 2022-03-11 15:04:28.239000             🧑  作者: 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");
}