当前位置:网站首页>JS get all date or time stamps between two time stamps
JS get all date or time stamps between two time stamps
2022-07-07 07:35:00 【GMLGDJ】
let start = new Date(1642694400000) // 2022-01-21 00:00:00
let end = new Date(1643644800000) // 2022-02-01 00:00:00
dateList = getAllDateCN(date1, date2)
console.log(dateList);
function getAllDateCN(startTime, endTime) {
let date_all = [];
let i = 0;
while (endTime.getTime() - startTime.getTime() >= 0) {
// Get date and time
let year = startTime.getFullYear()
let month = startTime.getMonth() + 1
let day = startTime.getDate()
let time = startTime.toLocaleTimeString()
date_all[i] = year + ' year ' + month + ' month ' + day + ' Japan ' + time
// Get daily 00:00:00 The timestamp
// date_all[i] = new Date(startTime.toLocaleDateString()).getTime() / 1000;
// Days +1
startTime.setDate(startTime.getDate() + 1);
i += 1;
}
return date_all;
}
边栏推荐
- Wechat applet full stack development practice Chapter 3 Introduction and use of APIs commonly used in wechat applet development -- 3.9 introduction to network interface (IX) extending the request3 met
- Jenkins远程构建项目超时的问题
- Invalid table alias or column reference`xxx`
- Flexible layout (II)
- 1089: highest order of factorial
- Outsourcing for four years, abandoned
- Pass parent component to child component: props
- Outsourcing for three years, abandoned
- Kuboard无法发送邮件和钉钉告警问题解决
- Tencent's one-day life
猜你喜欢
毕设-基于SSM大学生兼职平台系统
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
3、 High quality programming and performance tuning practical youth training camp notes
Lm11 reconstruction of K-line and construction of timing trading strategy
Outsourcing for three years, abandoned
Leetcode-206. Reverse Linked List
Redis data migration
关于二进制无法精确表示小数
抽丝剥茧C语言(高阶)数据的储存+练习
Jenkins远程构建项目超时的问题
随机推荐
MobaXterm
身边35岁程序员如何建立起技术护城河?
Lm11 reconstruction of K-line and construction of timing trading strategy
Advanced practice of C language (high level) pointer
Hidden Markov model (HMM) learning notes
抽丝剥茧C语言(高阶)指针进阶练习
Mutual conversion between InputStream, int, shot, long and byte arrays
二、并发、测试笔记 青训营笔记
nacos
Interviewer: what development models do you know?
Unity C function notes
../ And/
2、 Concurrent and test notes youth training camp notes
记一个并发规则验证实现
I failed in the postgraduate entrance examination and couldn't get into the big factory. I feel like it's over
Convolutional neural network -- understanding of pooling
Calculus key and difficult points record part integral + trigonometric function integral
Detailed explanation of transform origin attribute
1090: integer power (multi instance test)
English translation is too difficult? I wrote two translation scripts with crawler in a rage