JavaScript的Date對象(二)

<head>
    <title></title>
    <script type="text/javascript">
        var MyDate = new Date();
        document.write(MyDate.toString() + "<br/>");
        document.write(MyDate.toDateString() + "<br/>");
        document.write(MyDate.toTimeString() + "<br/>");
        document.write(MyDate.toLocaleString() + "<br/>");
        document.write(MyDate.toLocaleDateString() + "<br/>");
        document.write(MyDate.toLocaleTimeString() + "<br/>");
        document.write(MyDate.toUTCString() + "<br/>");
        document.write(MyDate.valueOf());
    </script>
</head>
 
 
 
Tue Mar 01 2011 19:02:30 GMT+0800
Tue Mar 01 2011
19:02:30 GMT+0800
2011年3月1日19:02:30
2011年3月1日
19:02:30
Tue, 01 Mar 2011 11:02:30 GMT
1298977350965
 
 
 作者 徐越的專欄

You May Also Like