zoukankan      html  css  js  c++  java
  • date对象获取get

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>date对象</title>
    </head>
    <body>
        <script>
            today=new Date();//获取今天的日期
            document.write(today+"<hr />");//Thu Dec 12 2019 20:50:03 GMT+0800 (中国标准时间)
            //单独获取年月日时分秒
            var weeks=["","","","","","",""];//因星期返回的是数字,使用数组的方式返回星期的字样
            //索引:weeks[0,   1,   2,  3,   4,   5,   6];
            var year=today.getFullYear(),//返回年
                month=today.getMonth()+1,//返回月…………月返回的数值比正常的月份-1
                date=today.getDate(),//返回日
                week=today.getDay(),//返回星期…………星期返回的是数字从0-6,0表示星期日
                hours=today.getHours(),//返回时
                minutes=today.getMinutes(),//返回分
                seconds=today.getSeconds(),//返回秒
                times=today.getTime();//返回表示日期的毫秒数
            document.write(year+"<hr />");//2019
            document.write(month+"<hr />");//12
            document.write(date+"<hr />");//12
            document.write(week+"<hr />");//4
            document.write(hours+"<hr />");//21
            document.write(minutes+"<hr />");//2
            document.write(seconds+"<hr />");//
            document.write("现在是北京时间:"+year+""+month+""+date+""+hours+""+minutes+""+seconds+"秒 星期"+weeks[week]+"<hr />");
            document.write(times);//表示从1970年1月1日00:00:00开始到现在时间的毫秒数
        </script>
    </body>
    </html>
  • 相关阅读:
    br_
    -fpic -fPIC -fpie -fPIE
    (OK) cross_compile_readline_for_android-x86_64-6.0
    Installing the GNU Readline library
    How to get libreadline for Android?
    (OK)(OK) seem-tools-init-android-x86_64-6.0-rc1-0.sh
    (OK)(OK) seem-tools-CLI-semi-auto.sh---nic1_2-hostonly-bridged
    (OK)(OK) seem-tools-auto_create_vm_android.sh
    (OK) run my script at boot time in android-x86_64 (Chih-Wei Huang)
    【习题 3-4 UVA
  • 原文地址:https://www.cnblogs.com/vinson-blog/p/12031882.html
Copyright © 2011-2022 走看看