zoukankan      html  css  js  c++  java
  • 时间格式处理

    obtainTime(){
            let date = new Date();
            let time = ''
            time+=date.getFullYear()+'-'
            time+=(date.getMonth()+1)>=10 ? (date.getMonth()+1) : '0'+(date.getMonth()+1)+'-'
            time+=date.getDate()>=10 ? date.getDate() : '0'+date.getDate()
            time+=' '
            time+=date.getHours()>=10 ? date.getHours() : '0'+date.getHours()
            time+=':'
            time+=date.getMinutes()>=10 ? date.getMinutes() : '0'+date.getMinutes()
            time+=':'
            time+=date.getSeconds()>=10 ? date.getSeconds() : '0'+date.getSeconds()
            this.setState({
                time:time
            })
        }
        computeTime(){
            setInterval(() => {
                this.obtainTime()
            }, 1000)
        }
     
    formateDate(time){
            if(!time) return '';
            let date = new Date(time)
            return date.getFullYear() + '-' + (date.getMonth()+1).toString().padStart(2,'0')+'-'+date.getDate().toString().padStart(2,'0')+'  '+date.getHours().toString().padStart(2,'0')+':'+date.getMinutes().toString().padStart(2,'0')+':'+date.getSeconds().toString().padStart(2,'0') 
    }
  • 相关阅读:
    mod_wl.so,apxs,mod_so.c,withmpm=worker,selinux;apapche&weblogic链接配置
    rc.local
    库没启动,报:ORA01034: ORACLE not available
    Socket编程简单示例
    基于UDP的Socket编程
    代理模式
    [转]Tomcat Server.xml 标签详解
    创建和使用URL访问网络资源
    myeclipse8.5中 集成svn
    div+css布局之固定定位布局
  • 原文地址:https://www.cnblogs.com/MDGE/p/12716278.html
Copyright © 2011-2022 走看看