小程序 wxml 中 格式化时间


<wxs module="formatTime">
  var formatTimeCoupon = function(times){
    var date = getDate((times*1000));
    var year = date.getFullYear()
    var month = date.getMonth() + 1
    var day = date.getDate()
    month = month > 9 ? month : '0' + month
    day = day > 9 ? day : '0' + day
    return year + '.' + month + '.' + day
  }
  module.exports = {
    formatTimeCoupon:formatTimeCoupon
  }
</wxs>
<view>有效期至 {{formatTime.formatTimeCoupon(时间戳)}}</view>

注意:没有 new Date()   要用  getDate()


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM