亚洲综合在线一区,日韩欧美偷情高潮,久久伊人精品青青草原高清,中文字幕av解说

在頁面動態(tài)顯示系統(tǒng)時間

zhushican 3年前 (2022-10-07) 六六互聯(lián) 593 0

word; clear: both; text-indent: 2em; color: rgb(24, 30, 51); font-family: PingFangSC, 微軟雅黑, 黑體, Arial, Helvetica, sans-serif; font-size: 18px; background-color: rgb(255, 255, 255);">在頁面動態(tài)顯示系統(tǒng)時間

word; clear: both; text-indent: 2em; color: rgb(24, 30, 51); font-family: PingFangSC, 微軟雅黑, 黑體, Arial, Helvetica, sans-serif; font-size: 18px; background-color: rgb(255, 255, 255);">Date對象

使用Date對象,必須先使用new運算符創(chuàng)建它,Date對象的構(gòu)造函數(shù)通過可選的參數(shù),可生成過去、現(xiàn)在和將來的Date對象,創(chuàng)建Date常見方式有三種。

1. 不帶參數(shù)

var myDate=new Date();

創(chuàng)建一個含有系統(tǒng)當前日期和時間的Date對象變量myDate。

2. 創(chuàng)建一個指定日期的Date對象

        var myDate=new Date(“2019/05/01”);

        使用代表日期和時間的字符串創(chuàng)建一個特定日期的Date對象,上述語句創(chuàng)建了2019年5月1日的Date變量myDate。

3. 創(chuàng)建一個指定時間的Date對象

var myDate=new Date(2014, 6, 1, 10, 30, 20, 50);

        語句創(chuàng)建了一個包含確切日期和時間的Date變量myDate,即2014年6月1日10點30分20秒50毫秒。

Date對象的常用方法                                                   

 

方法名

 
 

描述

 
 

getYear()

 
 

返回年份數(shù)

 
 

getFullYear()

 
 

返回年份數(shù)

 
 

getMonth()

 
 

返回月份數(shù)(0--11)

 
 

getDate()

 
 

返回日期數(shù)(1--31)

 
 

getDay()

 
 

返回星期數(shù)(0--6)

 
 

getHours()

 
 

返回時數(shù)(0--23)

 
 

getMinutes()

 
 

返回分數(shù)(0--59)

 
 

getSeconds()

 
 

返回秒數(shù)(0--59)

 
 

getMilliseconds()

 
 

返回毫秒數(shù)(0--999)

 
 

getTime()

 
 

返回對應日期基線的毫秒

 
 

toGMTString()

 
 

以GMT格式表示日期對象

 
 

toLocaleString()

 
 

返回日期的字符串表示,其格式根據(jù)系統(tǒng)當前的區(qū)域設(shè)置來確定