zoukankan      html  css  js  c++  java
  • 微信小程序:将yyyy-mm-dd格式的日期转换成yyyy-mm-dd hh:mm:ss格式的日期

    代码如下:

    changeDate1(e) {
        console.log(e);
        var date =  new Date(e.detail.value); 
        console.log(date);
        const year = date.getFullYear()
        const month = date.getMonth() + 1
        const day = date.getDate()
        const hour = date.getHours()
        const minute = date.getMinutes()
        const second = date.getSeconds()
        const formatNumber = n => {
          n = n.toString()
          return n[1] ? n : '0' + n
        }
        var dateString = [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
        console.log(dateString);
        this.QueryParams.pestDate = dateString
            this.setData({
                'material.pestDate': e.detail.value
            });
      },
  • 相关阅读:
    HDU-5384
    UVALive 5099
    ZOJ-2753
    HUD-5379
    HDU-5360
    HDU-5351
    HDU-5335
    HDU-5317
    HDU-2487
    常用十六进制颜色对照表代码查询
  • 原文地址:https://www.cnblogs.com/zwh0910/p/14214724.html
Copyright © 2011-2022 走看看