当前位置:网站首页>对导入的 excel 的时间的处理 将excel表中的时间,转成 标准的时间
对导入的 excel 的时间的处理 将excel表中的时间,转成 标准的时间
2022-08-09 14:54:00 【小羊卷】
对导入的 excel 的时间的处理 将excel表中的时间,转成 标准的时间
export const formatDate = (numb, format) => {
const time = new Date((numb - 1) * 24 * 3600000 + 1)
time.setYear(time.getFullYear() - 70)
const year = time.getFullYear() + ''
const month = time.getMonth() + 1 + ''
const date = time.getDate() - 1 + ''
if (format && format.length === 1) {
return year + format + month + format + date
}
return (
year + (month < 10 ? '0' + month : month) + (date < 10 ? '0' + date : date)
)
}案例代码如下
1-将上面的方法,封装成一个单独的js文件,在这里叫做 excelata
导入组件并使用
// 导入组件
import { formatDate } from '@/utils/excelata'
formatDate(item[key], '-') 第一个参数是表格中的时间,第二个参数是连接符 在这里用- 连接边栏推荐
- .Net Core动态注入
- 是什么推动了量化交易接口的发展?
- Introduction to OpenCV and build the environment
- 原子的核型结构及氢原子的波尔理论
- How to make your quantitative trading system have probabilistic advantages and positive return expectations?
- Stock trading stylized how to understand their own trading system?
- xshell7连接工具下载
- 数组学习笔记
- WebGL:BabylonJS入门——初探:我的世界
- Redis6.2.1配置文件详解
猜你喜欢
随机推荐
量子力学初步
Servlet的生命周期
What do professional quantitative traders think about quantitative trading?
JVM简学笔记
ImageWatch无法显示图像
跨平台桌面应用 Electron 尝试(VS2019)
ASP.Net Core实战——初识.NetCore
相干光(光学)
大咖说·对话生态|当Confluent遇见云:实时流动的数据更有价值
The difference between show and exec in Qt dialog
回收站一直显示未清空的图标问题
工作不等于生活,但生活离不开工作 | 2022 年中总结
Bean的生命周期
常用类学习
WebGL:BabylonJS入门——初探:注入活力
排序方法(希尔、快速、堆)
Talking about Shallow Cloning and Deep Cloning of ArraryList
什么是模板引擎?常见的模板引擎有哪些?thymeleaf的常用指令介绍。
Simple analysis of regularization principle (L1 / L2 regularization)
几何光学简介









