Restoration
11/11/2016 - 11:51 AM

0字詰め

0字詰め

var zeroformat = function(val){
  val += "";
  if(val.length === 1){
    val = "0" + val;
  }
  return val
}
var date = new Date();
var yyyy = date.getFullYear();
var mm = zeroformat(date.getMonth() + 1);
var dd = zeroformat(date.getDate());
var hh = zeroformat(date.getHours());
var mi = zeroformat(date.getMinutes());