<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()