Untitled
unknown
plain_text
25 days ago
405 B
3
Indexable
Never
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
Leave a Comment