function getDate() {
var d = new Date(),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = '' + d.getFullYear(),
hh = '' + d.getHours(),
mm = '' + d.getMinutes(),
ss = '' + d.getSeconds()
;
if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;
if (hh.length < 2) hh = '0' + hh;
if (mm.length < 2) mm = '0' + mm;
if (ss.length < 2) ss = '0' + ss;
return [year, month, day].join('-') + ' ' + [hh, mm, ss].join(':');
}
'웹 > javascript' 카테고리의 다른 글
fabric.js strokeWidth bug ? (0) | 2018.08.31 |
---|---|
PWA 프로그레시브웹앱 (0) | 2018.07.19 |
vue에서의 this (0) | 2018.06.13 |
chrome console 기능 (0) | 2018.05.22 |
NaN !== NaN (0) | 2018.05.22 |