zoukankan      html  css  js  c++  java
  • 获取当前时间

           Vue.prototype.getYearMonthDayTime=function(
                    symbolExpressYear = "-",
                    symbolExpressMonth = "-",
                    symbolExpress = ":"
                ) {
                    let date = new Date();
                    let yearTime = date.getFullYear(); // 获取完整的年份(4位,1970)
                    let MonthTime =( date.getMonth() + 1)>9 ?( date.getMonth() + 1) : "0"+( date.getMonth() + 1); // 获取月份(0-11,0代表1月,用的时候记得加上1)
                    let dayTime = date.getDate()>9 ? date.getDate() :"0"+date.getDate(); // 获取日(01-31)
                
                    let HoverTIme = date.getHours()>9 ? (date.getHours()) :("0"+date.getHours()); // 获取小时数(0-23)
                    let MinyutesTime = date.getMinutes()>9 ? (date.getMinutes()) : ("0"+date.getMinutes()); // 获取分钟数(0-59)
                    let secondsTime = date.getSeconds()>9 ? (date.getSeconds()) :("0"+date.getSeconds()); // 获取秒(0-59)
                
                    return (
                        yearTime +
                        symbolExpressYear +
                        MonthTime +
                        symbolExpressMonth +
                        dayTime +
                        " " +
                        HoverTIme +
                        symbolExpress +
                        MinyutesTime +
                        symbolExpress +
                        secondsTime
                  );
            },
    
    getYearMonthDayTime()
    可以传递参数
    
    http://localhost:8081/#/home?VNK=0d6e095f&accesstoken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcGVuQWNjb3VudElkIjoiNDcwOTQ1MTYzMDUzNzY0NjA4IiwidGVuYW50SWQiOiIwIiwicGxhdGZvcm1UeXBlIjoicGMiLCJpZCI6IjQ1MDcyOTI2NDkzODA5NDYwNyIsIm9wZW5Vc2VySW5mb0lkIjoiNDcwOTQ1MTYzMDI4NTk4Nzg1IiwidXNlck5hbWUiOiIxODM4Mzg0MTUxMyIsImV4cCI6MTU5ODg1OTk2OCwib3JnSWQiOiI0NTA2OTc5MDY0Mjk3NTk2MTIiLCJ1c2VySW5mb0lkIjoiNDUwNzI5MjY0OTM4MDk0NjA2In0.j8Y0iZHRcbN_X7-hkqRimO9CwNzyTWlQu2kuCryl5QQ
    
  • 相关阅读:
    在Linux中安装Oracle(较详细图解)
    SecureCRT
    MHA配置文件说明
    MySQL建表规范与常见问题 (go)
    Shell编程时常用的系统文件(转)
    Leetcode: Excel Sheet Column Title
    Leetcode: Find Peak Element
    Leetcode: Intersection of Two Linked Lists
    Leetcode: Majority Element
    Summary: Class Variable vs. Instance Variable && Class Method
  • 原文地址:https://www.cnblogs.com/IwishIcould/p/13408364.html
Copyright © 2011-2022 走看看