zoukankan      html  css  js  c++  java
  • moment.js 的简单应用

     moment.js :时间处理的组件

    例子:moment.html

    <!DOCTYPE html>
    <html>
    <head>
        <title>moment.js</title>
        <meta charset="utf-8">
         <script type="text/javascript" src="jquery.min.js"></script>
    <script src="moment.min.js"></script>
    
    </head>
    <body>
    hi, I am moment.
    以下是时间:
        <div class="www">
            
        </div>
    <script >
            
                $('.www').html(moment().format());           
            
             //亦可
            // function a(){
            //     $('.www').html(moment().format());           
            // }
            // a();
    </script>
    </body>
    
    </html>

     

    简单了解常用的用法。比如:

    1)能把日期以常见的格式展示 如2016年5月3号  2016年05月03号 2016年05月03号 3时;

    2)能获取两个时间的时间差,差的 年、月、日、时、分、秒;

    3)当前时间往前100个小时是什么时间,往后100个小时是什么时间;

     

     

  • 相关阅读:
    最少必要知识
    pythonGUI编程
    计算机网络基础
    .htaccess总结
    SSRF总结
    jsp学习笔记
    url任意跳转漏洞
    学期总结
    计科一班本学期作业成绩汇总表格
    C语言I博客作业08
  • 原文地址:https://www.cnblogs.com/shenxiaolin/p/6076046.html
Copyright © 2011-2022 走看看