JavaScript Date 对象参考手册

Date 对象

Date 对象用于处理日期和时间。

创建 Date 对象的语法:

var myDate=new Date()

注释:Date 对象会自动把当前日期和时间保存为其初始值。


Date 对象属性

FF: Firefox, IE: Internet Explorer

    (1)    constructor 属性返回对创建此对象的 Date 函数的引用。  

            语法

        object.constructor

                

实例

在本例中,我们将展示如何使用 constructor 属性:

 1<script type="text/javascript">
 2
 3var test=new Date();
 4
 5if (test.constructor==Array)
 6{
 7document.write("This is an Array");
 8}

 9if (test.constructor==Boolean)
10{
11document.write("This is a Boolean");
12}

13if (test.constructor==Date)
14{
15document.write("This is a Date");
16}

17if (test.constructor==String)
18{
19document.write("This is a String");
20}

21
22</script>

    输出:

    This is a Date


    
    (2)

posted on 2010-03-12 17:27 housen 阅读(80) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 
<2010年3月>
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论