当前位置:网站首页>对导入的 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], '-') 第一个参数是表格中的时间,第二个参数是连接符 在这里用- 连接
边栏推荐
- For programming trading, focusing on forecast or on countermeasures?
- Simply record offsetof and container_of
- 函数调用约定
- Suddenly want to analyze the mortgage interest rate and interest calculation
- 单向链表几个比较重要的函数(包括插入、删除、反转等)
- Bean的生命周期
- How to make your quantitative trading system have probabilistic advantages and positive return expectations?
- 分析:通过哪种方法来建立股票量化交易数据库?
- pytorch从零搭建神经网络实现多分类(训练自己的数据集)
- ASP.Net Core实战——身份认证(JWT鉴权)
猜你喜欢
注解与反射
记一次解决Mysql:Incorrect string value: ‘\xF0\x9F\x8D\x83\xF0\x9F...‘ for column 插入emoji表情报错问题
6大论坛,30+技术干货议题,2022首届阿里巴巴开源开放周来了!
Introduction to OpenCV and build the environment
九、【Vue-Router】缓存路由组件 keep-alive标签
Inverted order at the beginning of the C language 】 【 string (type I like Beijing. Output Beijing. Like I)
爱因斯坦的光子理论
pytorch从零搭建神经网络实现多分类(训练自己的数据集)
量子力学初步
JVM简学笔记
随机推荐
Qt对话框中show和exec的区别
LNK1123:转换到COFF期间失败:文件无效或损坏
生产者/消费者问题(线程信号)
常见的数学物理方程
如何让你的量化交易系统具有概率优势,具有正向收益预期呢?
In the process of quantitative trading, retail investors can do this
Several important functions of singly linked list (including insertion, deletion, reversal, etc.)
[Mysql]--事务、事务的隔离级别、脏读、不可重复读、幻读解析
At the beginning of the C language order 】 【 o least common multiple of three methods
Bean的生命周期
WebGL:BabylonJS入门——初探:我的世界
How do users correctly understand programmatic trading?
Simply record offsetof and container_of
小型项目如何使用异步任务管理器实现不同业务间的解耦
【小白必看】初始C语言(下)
如何灵活运用量化交易接口的优势取长补短?
How to achieve long-term benefits through the Tongdaxin quantitative trading interface?
CV复习:过拟合、欠拟合
ASP.Net Core实战——使用Swagger
[MySql] implement multi-table query - one-to-one, one-to-many