日付
指定した日付の年・月・日を表示する
<html>
<body>
<script language="Javascript">
<!--
d = new Date();
yy = d.getYear();
mm = d.getMonth() + 1;
dd = d.getDate();
document.write( yy + "/" + mm + "/" + dd);
-->
</script>
</body>
</html>
|
【解説】
getYear(),getMonth(),getDate()でそれぞれ、年・月・日を取得します。
サンプル
関連リンク
現在の時刻を表示する
現在の時刻を表示する(1秒おきに)
指定した時刻の時分秒ミリ秒を表示する
世界標準時刻や規定の書式で日付を表示する
スポンサードリンク
| |