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

    export function timeFormat(time: Date, type: string) {
      // yyyy MM dd hh:mm:ss
      const year = `${time.getFullYear()}`;
      const month = (time.getMonth() + 1 < 10 ? `0${time.getMonth() + 1}` : `${time.getMonth() + 1}`);
      const day = (time.getDate() < 10 ? `0${time.getDate()}` : `${time.getDate()}`);
      const hours = (time.getHours() < 10 ? `0${time.getHours()}` : `${time.getHours()}`);
      const minutes = (time.getMinutes() < 10 ? `0${time.getMinutes()}` : `${time.getMinutes()}`);
      const seconds = (time.getSeconds() < 10 ? `0${time.getSeconds()}` : `${time.getSeconds()}`);
      let newTime = type.replace('yyyy', year).replace('MM', month).replace('dd', day);
      newTime = newTime.replace('hh', hours).replace('mm', minutes).replace('ss', seconds);
      return newTime;
    }
    

      

  • 相关阅读:
    Pillar
    Minion配置文件
    Master配置文件
    Grains
    常见的散列函数
    数据结构散列表
    转载:数据结构 二项队列
    转载:数据结构 左式堆
    数据结构 d-堆
    二叉堆的简单介绍
  • 原文地址:https://www.cnblogs.com/wangxirui/p/15218586.html
Copyright © 2011-2022 走看看