timeNodeConversion

功能描述

传入时间戳后,时间节点转换 多少分钟之前,多少小时之前,多少天之前, xx 年 xx 月 xx 日 xx:xx

依赖的模块

快速使用

  1. <div class="">请输入13位时间戳</div>
  2. <input id="time" type="text" class="" maxlength="13">
  3. <button class="" onclick="timeNodeConversion()">确定</button>
  4. <div class="">结果</div>
  5. <input id="reast" type="text" class="">
  1. function timeNodeConversion() {
  2. var time = document.getElementById("time").value;
  3. if (time.length <13) {
  4. alert("请输入13位时间戳")
  5. return
  6. };
  7. $timeNodeConversion.timeago(time, function (res) {
  8. document.getElementById("reast").value = res;
  9. })
  10. }

特别说明

  1. 输入13位时间戳,输入其他位数的时间戳将导致无法实现