Still, if you want to compare those operators which I told you can not use. In the above example, first we are constructing the dates with delimiter -then we are comparing the first date with second date, if both dates are equal it returns true else it returns false if it is not equal.. Second way using toDateString() method. Given a Date instance, we can use the getDate(), getMonth() and getFullYear() methods, which return the day, month and year of a date, and compare them to today, which can be retrieved using new Date(). In Javascript comparing date is quite simple. Thus, we can compare dates in many possible ways. . JavaScript's Date Object. Here, with the help of those methods, we will learn to compare dates. console . The dates can belong to any frame i.e past, present and future. Use Date() function to create an object in JavaScript with current date and time. Opera … 2. var today = new Date(); We can also change or set the format through JavaScript code. "); }