function getToday(){
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1; //1월이 0으로 되기때문에 +1을 함.
var date = now.getDate();
month = month >=10 ? month : "0" + month;
date = date >= 10 ? date : "0" + date; // ""을 빼면 year + month (숫자+숫자) 됨.. ex) 2018 + 12 = 2030이 리턴됨.
//console.log(""+year + month + date);
return today = ""+year + month + date;
}
반응형
'jQuery' 카테고리의 다른 글
Ajax 파일업로드 multipart/form-data submit (0) | 2019.05.08 |
---|---|
[Javascript] undefined, null 체크 (0) | 2019.04.30 |
jquery action, submit (0) | 2018.11.26 |
jquery - 클립보드 복사하기 (0) | 2018.07.25 |
jquery HTML DOM 객체 존재 여부 체크 (0) | 2018.06.23 |