js 페이지 시간

1457 단어 js 페이지 시간

 
  function showTime () {
	      var tick = new Date();
	      var hours = tick.getHours();
	      var minutes = tick.getMinutes();
	      var seconds = tick.getSeconds();
	      var day = tick.getDay();
	      var month = tick.getMonth() + 1;
	      var date = tick.getDate();
	      var year = tick.getYear();
	      if (year < 1900) {
	      	year += 1900;//        1900
	      }
	      var weekday = "";
	      if(day==0){weekday = "    ";}
	      if(day==1){weekday = "    ";}
	      if(day==2){weekday = "    ";}
	      if(day==3){weekday = "    ";}
	      if(day==4){weekday = "    ";}
	      if(day==5){weekday = "    ";}
	      if(day==6){weekday = "    ";}
	      var current = year + " " + 
	      				month +" " + 
	      				date + " " + 
	      				weekday + 
	      				((hours >= 12) ? "    " : "    ") + 
	      				((hours >12) ? hours -12 : hours);
	      current += ((minutes < 10) ? ":0" : ":") + minutes;
	      current += ((seconds < 10) ? ":0" : ":") + seconds;
	      
	      $('#timer').text(current);
	      setTimeout("showTime()",1000);
		}



좋은 웹페이지 즐겨찾기