자바스크립트 날짜 YYYYMMDD 포멧 변경

    ~~~  

     

     

     var currDate = new Date(); // 현재 날짜 생성
     currDate=dateToYYYYMMDD(currDate);

     

     alert( currDate );

             //2016-04-25

    }

     

     

    //데이트 포멧
    function dateToYYYYMMDD(date){
        function pad(num) {
            num = num + '';
            return num.length < 2 ? '0' + num : num;
        }
        return date.getFullYear() + '-' + pad(date.getMonth()+1) + '-' + pad(date.getDate());
    }

    'Developers' 카테고리의 다른 글

    Mybatis if  (0) 2016.04.26
    checkbox 컨트롤  (1) 2016.04.26
    ajax로 받아서 동적 테이블  (0) 2016.04.22
    MySQL 내장 함수  (0) 2016.04.21
    톰캣 실행 오류 : The specified JRE installation does not exist  (0) 2016.04.20

    댓글