JSFiddle - React, Tailwind, and code Playground

HTML

<div>
yyyymmdd: <span id="a"></span>
</div>
<div>
yyyymmddhhmm: <span id="b"></span>
</div>
<div>
yyyymmddhhmmss: <span id="c"></span>
</div>

JavaScript

Date.prototype.yyyymmdd = function() {
   var yyyy = this.getFullYear();
   var mm = this.getMonth() < 9 ? "0" + (this.getMonth() + 1) : (this.getMonth() + 1); // getMonth() is zero-based
   var dd  = this.getDate() < 10 ? "0" + this.getDate() : this.getDate();
   return "".concat(yyyy+"y ").concat(mm+"m ").concat(dd+ "d ");
  };

 Date.prototype.yyyymmddhhmm = function() {
   var yyyymmdd = this.yyyymmdd();
   var hh = this.getHours() < 10 ? "0" + this.getHours() : this.getHours();
   var min = this.getMinutes() < 10 ? "0" + this.getMinutes() : this.getMinutes();
   return "".concat(yyyymmdd).concat(hh+"h ").concat(min+" min");
  };

 Date.prototype.yyyymmddhhmmss = function() {
   var yyyymmddhhmm = this.yyyymmddhhmm();
   var ss = this.getSeconds() < 10 ? "0" + this.getSeconds() : this.getSeconds();
   return "".concat(yyyymmddhhmm).concat(ss+ "sec");
  };

var d = new Date();
document.getElementById("a").innerHTML  = d.yyyymmdd();
document.getElementById("b").innerHTML  = d.yyyymmddhhmm();
document.getElementById("c").innerHTML  = d.yyyymmddhhmmss();