首页 > Web开发 > 详细

js/ts/tsx读取excel表格中的日期格式转换

时间:2020-06-27 00:56:29      阅读:209      评论:0      收藏:0      [点我收藏+]
  const formatDate = (timestamp: number) => {
    const time = new Date((timestamp - 1) * 24 * 3600000 + 1);
    time.setFullYear(time.getFullYear() - 70);
    const year = time.getFullYear();
    const month = time.getMonth() + 1;
    const date = time.getDate() - 1;
    const format = ‘-‘;
    return (
      year + format + (month < 10 ? `0${month}` : month) + format + (date < 10 ? `0${date}` : date)
    );
  };

 

js/ts/tsx读取excel表格中的日期格式转换

原文:https://www.cnblogs.com/lishidefengchen/p/13196895.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!