書式
日付オブジェクト.getDay()
説明
曜日を数値で返します。数値と曜日は以下のように対応しています。
getDayの値 | 曜日 |
0 | 日曜日 |
1 | 月曜日 |
2 | 火曜日 |
3 | 水曜日 |
4 | 木曜日 |
5 | 金曜日 |
6 | 土曜日 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
</head>
<body>
<script type="text/javascript"><!--
dateObj = new Date();
d = dateObj.getDay();
document.write("日月火水木金土".charAt(d)+"曜日");
// --></script>
</body>
</html>