1. 程式人生 > 其它 >javascript當中Date物件用法

javascript當中Date物件用法

javascript當中Date物件用法

2.Date物件

例 2.1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<Script>
/*馬克-to-win:Global有個Date()這個方法。*/
/*When the Global object is created, it always has at least the following properties:
Object object Function object Array object String object
Boolean object Number object Date object Math object
Value properties
*/
var today = new Date();
var month = today.getMonth()+1;
var date = today.getDate();
var day = today.getDay();
document.write("今天是");
document.write(month+"月");
document.write(date+"日");
document.write("星期"+day);//注意:是阿拉伯數字並非中文;請試改為中文習慣
var s="除錯站位";
</Script>
</head>
<body>

</body>
</html>

更多內容請見原文,文章轉載自:

https://blog.csdn.net/qq_43650923/article/details/100168991