Web/Javascript_Jquery

오늘 날짜 구하기 yyyy-mm-dd

벨포트조던 2016. 2. 24.
반응형

  var now = new Date();

      var year= now.getFullYear();
      var mon = (now.getMonth()+1)>9 ? ''+(now.getMonth()+1) : '0'+(now.getMonth()+1);
      var day = now.getDate()>9 ? ''+now.getDate() : '0'+now.getDate();
              
      var chan_val = year + '-' + mon + '-' + day;
      $(this).val(chan_val);




오라클 sysdate 처럼 간단한거 없을까 ?

반응형

댓글