javascript Date API

Javascript 2009. 8. 11. 17:39



function getDateForm()
{
 var form  = document.info;
 var now = new Date();
 year = now.getYear();
 month = now.getMonth() + 1;
 day = now.getDate();
 min = now.getMinutes();
 sec = now.getSeconds();
 ampm = (now.getHours() >= 12) ? "오후" : "오전";
 hour = now.getHours();

 hour = ((hour > 12) ? hour - 12 : hour );
 min = ((min >= 10) ? min : "0" + min);
 sec2 = ((sec >= 10) ? sec : "0" + sec);
 
 day_title = getWantDayOfWeekTitle( getWantDayOfWeek(year,month,day)  )+'요일';
 
 
    //2006.09.30 15:30:07 화요일
 form.sTime.value = "" + year + ". " +toLen2( month )+ ". " + toLen2(day) + "  " + ampm + " " + hour + ":" + min + ":" + sec2+ " "+ day_title

 now.setSeconds(sec + 1);
 window.setTimeout('getDateForm()', 1000);
}

Posted by 철냄비짱
,