zoukankan      html  css  js  c++  java
  • JS时间的获得

     <script type="text/javascript">
            var thedate = new Date();
            alert('LocaleString:' + thedate.toLocaleString()); //将时间转换成本地的字符串表示
            alert('LocaleDateString:' + thedate.toLocaleDateString());//将年月日转换成本地的字符串表示
            alert('LocaleTimeString:' + thedate.toLocaleTimeString());//将时间转换成本地的字符串表示
            alert('Date:' + thedate.getDate());//获取当前的日
            alert('Day:' + thedate.getDay());
            alert('Year:' + thedate.getFullYear());//获取当前的年份
            alert('Hours:' + thedate.getHours());//获取当前的小时
            alert('Milliseconds:' + thedate.getMilliseconds());//获取当前的毫秒
            alert('Minutes:' + thedate.getMinutes());//获取当前的分钟
            alert('Month:' + (thedate.getMonth()+1));//如果用整数表示月份的话,0代表1月,1代表2月...11代表12月

            alert('Seconds:' + thedate.getSeconds());//获取当前秒

    </script>

  • 相关阅读:
    C# 课堂总结2-数据类型及转换方式
    C# 课堂总结1-二进制转换
    C++
    C++ 程序设计语言
    VS编译器问题总结
    go 笔记
    SIP协议 会话发起协议(二)
    SIP协议 会话发起协议(一)
    201707 一些好的文章
    编程拾穗
  • 原文地址:https://www.cnblogs.com/duanlinlin/p/3010827.html
Copyright © 2011-2022 走看看