Checking if two Dates have the same date info

后端 未结 8 662
清歌不尽
清歌不尽 2020-11-27 05:40

How can I check if two different date objects have the same date information(having same day, month, year ...)? I have tried "==", "===" and .equals but

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 06:08

    Type convert to integers:

    a = new Date(1995,11,17);
    b = new Date(1995,11,17);
    +a === +b;  //true
    

提交回复
热议问题