MEMO/Js-memo
jquery 날짜 변환
by hingu
2024. 7. 23.
//오늘날짜 알아오는 스크립트
let $jdate = new Date();
let $y = $jdate.getFullYear(); //date() 에서 년도만 출력
let $m = $jdate.getMonth()+1;
let $d = $jdate.getDate()
let $toString = $jdate.toLocaleDateString();
let $toString2 = $jdate.toLocaleString();
let $toString3 = $jdate.toISOString();
let $toString4 = $toString3.substring(0,10);
console.log($toString) //2024. 7. 23.
console.log($toString2) //2024. 7. 23. 오후 3:44:24
console.log($toString3) //2024-07-23T06:45:33.083Z
console.log($toString4) //2024-07-23