console
function dateFormat(date,type){
var Year = date.getFullYear(),
Month = date.getMonth() + 1,
_Month = Month.toString().replace(/^(\d)$/,'0$1'),
Day = date.getDate(),
_Day = Day.toString().replace(/^(\d)$/,'0$1'),
Hours = date.getHours(),
_Hours = Hours.toString().replace(/^(\d)$/,'0$1'),
Minutes = date.getMinutes(),
_Minutes = Minutes.toString().replace(/^(\d)$/,'0$1'),
Seconds = date.getSeconds(),
_Seconds = Seconds.toString().replace(/^(\d)$/,'0$1');
var date = type.replace(/y+/gi,Year)
.replace(/M{2,}/,_Month).replace(/M/,Month)
.replace(/d{2,}/g,_Day).replace(/d/g,Day)
.replace(/h{2,}/g,_Hours).replace(/h/,Hours)
.replace(/m{2,}/,_Minutes).replace(/m/,Minutes)
.replace(/s{2,}/g,_Seconds).replace(/s/,Seconds);
return date;
}
var text;
text = dateFormat(new Date() ,'yyyy/MM/dd hh/mm/ss');
$('#main').append(`${text}<br>`)
text = dateFormat(new Date() ,'yyyy-MM-dd hh:mm:ss');
$('#main').append(`${text}<br>`)
text = dateFormat(new Date() ,'hh:mm');
$('#main').append(`${text}<br>`)
<div id="main"></div>