Dates Equal

by akmiecik

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>














<div style='position:fixed;top:0;left:0; background:lightgray;width:100%;'>
    <b>About this SO question</b>:
    <a href='http://stackoverflow.com/a/4428357/1366033'>
        Checking if two Dates have the same date info
    </a><br/>
    <b>Further Reading</b>:
    <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date'>
        MDN - Date Object
    </a><br/>
</div>

JavaScript

var a,b

a = new Date();
b = new Date(2022,04,17);
if (a.getTime() === b.getTime()){ 
console.log("True") // prints true
} else {
console.log("False") // prints false
}