날짜변환하기
const date = new Date();
const year = date.getFullYear();
const month = ('0' + (date.getMonth() + 1)).slice(-2);
const day = ('0' + date.getDate()).slice(-2);
const hours = ('0' + date.getHours()).slice(-2);
const minutes = ('0' + date.getMinutes()).slice(-2);
const seconds = ('0' + date.getSeconds()).slice(-2);
const dateStr = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
console.log(dateStr);
JavaScript - 날짜, 시간 포맷 (Date format) (codechacha.com)
let name = "홍길동";
let age = 25;
let message = `안녕하세요, 저는 ${name}이고 ${age}살입니다.`;
LIST
최근댓글