JSFiddle - React, Tailwind, and code Playground
by johnkoer
JavaScript
Date.prototype.toMyString = function () {
function padZero(obj) {
obj = obj + '';
if (obj.length == 1)
obj = "0" + obj
return obj;
}
var output = "";
output += this.getFullYear();
output += padZero(this.getMonth()+1);
output += padZero(this.getDate());
return output;
}
var d = new Date();
alert(d.toMyString());
var otherDate = new Date(2012,0,1);
alert(otherDate.toMyString());