Example 1: Here we will get yesterday’s date, in this example, we will show the output compared to today’s date. Syntax:
var dateObj = new Date(); // Empty Date constructor representing current time dateobj; // Current Time => Wed Jun 12 2019 20:52:24 GMT+0530 (India Standard Time)
The following programs illustrate the solution
Example 2: Here we will get the yesterday date of the pre-defined date which is Fri May 10, 2019, 16:30:00 GMT+0530 (India Standard Time).
var dateObj = new Date(2019, 04, 10, 16, 30, 00); // Specified Date constructor representing particular time dateObj; // Specific Time => Fri May 10 2019 16:30:00 GMT+0530 (India Standard Time)
Please Login to comment...