zoukankan      html  css  js  c++  java
  • 时间戳转换

    13位与10位时间戳转换

    filters: { //vue过滤器
      //时间戳改变
      timechange: function (value) { //13位时间戳
      var date = new Date(value);
      const Y = date.getFullYear() + '-';
      const M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
      const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
      const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
      const m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
      const s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
      return (Y+M+D+h+m+s);
    },
    
    //10位时间戳
    timechange: function (value) {
      var date = new Date(value);
      const Y = date.getFullYear() + '年';
      const M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '月';
      const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + '日';
      return (Y+M+D);
      },
    },
    
  • 相关阅读:
    完全二分图生成树计数
    [luogu 1880]石子合并
    [vijos 1770]大内密探
    母函数入门笔记(施工中…
    【补】20160816训练记录
    20160819训练记录
    20160817训练记录
    POJ 2228 naptime
    POJ 3585 Accumulation Degree
    POJ 2182 Lost Cows
  • 原文地址:https://www.cnblogs.com/hellogmy/p/14481600.html
Copyright © 2011-2022 走看看