본문 바로가기

먹고살거/KPI

[자바스크립트]4-1.내장객체(Date)

4-1.자바스크립트 내장객체(Date)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title> new document </title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<script type="text/javascript">

//<![CDATA[

var today = new Date();

console.log(today.getFullYear());

console.log(today.getMonth()+1);

console.log(today.getDate());

console.log(today.getDay());

console.log(today.getHours());

console.log(today.getMinutes());

console.log(today.getSeconds());

console.log(today.getTime());

console.log(today.setMonth(0));

alert(today.getMonth()+1);


var theday=new Date(2002,1,1);

console.log(theday.getDay());

//]]>

</script>

</head>

<body>


</body>

</html>