12 lines
407 B
JavaScript
12 lines
407 B
JavaScript
|
|
const getToday = () => {
|
||
|
|
const now = new Date();
|
||
|
|
const yy = String(now.getFullYear()).slice(2); // 연도 끝 두 자리
|
||
|
|
const mm = String(now.getMonth() + 1).padStart(2, "0"); // 월 (01~12)
|
||
|
|
const dd = String(now.getDate()).padStart(2, "0"); // 일 (01~31)
|
||
|
|
return `${yy}${mm}${dd}`;
|
||
|
|
};
|
||
|
|
|
||
|
|
// 실행
|
||
|
|
console.log(getToday()); // 예: 240217 (2024년 2월 17일)
|
||
|
|
|
||
|
|
module.exports = getToday;
|