반응형
JavaScript의 날짜관련 예제입니다.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>날짜관련내장객체</title>
<script type="text/javascript">
//현재 시간을 출력
var today = new Date();
//출력
document.write(today.getFullYear() + "<br/>");
document.write((today.getMonth() + 1) + "<br/>");
document.write(today.getDate() + "<br/>");
document.write(today.getDay() + "<br/>"); //0요일~6요일까지
document.write(today.getHours() + "<br/>");
document.write(today.getMinutes() + "<br/>");
document.write(today.getSeconds() + "<br/>");
document.write(today.getMilliseconds() + "<br/>");
</script>
</head>
<body>
</body>
</html>
<head>
<title>날짜관련내장객체</title>
<script type="text/javascript">
//현재 시간을 출력
var today = new Date();
//출력
document.write(today.getFullYear() + "<br/>");
document.write((today.getMonth() + 1) + "<br/>");
document.write(today.getDate() + "<br/>");
document.write(today.getDay() + "<br/>"); //0요일~6요일까지
document.write(today.getHours() + "<br/>");
document.write(today.getMinutes() + "<br/>");
document.write(today.getSeconds() + "<br/>");
document.write(today.getMilliseconds() + "<br/>");
</script>
</head>
<body>
</body>
</html>
반응형
'jQuery | javascript | CSS' 카테고리의 다른 글
00.jQuery - jQuery란? (0) | 2009.11.05 |
---|---|
33.JavaScript - 문자열관련함수 (0) | 2009.08.13 |
31.JavaScript - 이벤트 (Event) (0) | 2009.08.13 |
30.JavaScript - JavaScript에서 스타일시트 적용 (0) | 2009.08.12 |
29.JavaScript - SelectedIndex (드롭다운리스트) (0) | 2009.08.12 |
Comments