Date.getDay

書式

日付オブジェクト.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>