Untitled
unknown
plain_text
10 months ago
405 B
7
Indexable
Date.prototype.toCustomDateString = function() { const year = this.getFullYear(); const month = ('0' + (this.getMonth() + 1)).slice(-2); // Months are 0-based const day = ('0' + this.getDate()).slice(-2); return `${year}-${month}-${day}`; }; // Create a new Date object let currentDate = new Date(); // Display the formatted current date in the console console.log(currentDate.toCustomDateString
Editor is loading...
Leave a Comment