wxs 语法如何 把 2021-03-17 17:03:31 时间转换成时间戳呢?

小程序 文章 2021-03-18 14:01 483 0 全屏看文

AI助手支持GPT4.0

wxs 语法如何 把 2021-03-17 17:03:31 时间转换成时间戳呢?How does wxs syntax convert 2021-03-17 17:03:31 time into a timestamp?

wxs 语法如何 把 2021-03-17 17:03:31 时间转换成时间戳呢?

wxs 语法如何 把 2021-03-17 17:03:31  时间转换成时间戳呢?

How does WXS syntax convert 2021-03-17 17:03:31 time to timestamp?

回答:

Samuel.Schnappi:

wxs文件里

function formatTime(str) {

  if (str == null) {

    return;;

  } else {

    var timeStr = getDate(str).getTime();

    return timeStr;

  }

}

module.exports = {

  formatTime: formatTime

}

wxml文件里

<wxs src="/uploads/cj/article/2021/03/18/f9a9737b441a380938038be7376c3868.jpg" module="tools" />

{{tools.formatTime(你的时间参数)}}

<view>{{tools.formatTime("2021-03-17 17:03:31")}}</view>


大兵:
  var dealTime = function(timeString){    var date = getDate(timeString)    return date.getTime()  }  module.exports = {    dealTime:dealTime  }  {{test.dealTime('2021-03-17 17:03:31 ')}}  


https://developers.weixin.qq.com/miniprogram/deveference/wxs/06datatype.html

99🇨🇳:

有大佬不

詹迪克:

-EOF-

AI助手支持GPT4.0