用途:
指定時間

說明:

new Date(毫秒);
new Date(年,月,日);
new Date(年,月,日,時,分,秒);
期中的月份0~11
0為1月以此類推。

程式範例:
<script type ="text/javascript">
//宣告一個日期的變數,並取得現在日期。
//取得基準時間50000毫秒的時間
//基準時間為1970年1月1日0時0秒
var d = new Date(1000);
//將現在日期顯示在頁面上
document.write("時間為:"+d);
document.write("<br>");
d = new Date(2014,1,10);
//將現在日期顯示在頁面上
document.write("指定時間為:"+d);
 document.write("<br>");
 d = new Date(2014,1,10,8,30,30);
 //將現在日期顯示在頁面上
 document.write("指定時間為:"+d);
</script>

測試結果:

 









 















其它文章

arrow
arrow

    PG Levin Li 發表在 痞客邦 留言(0) 人氣()