網站首頁 編程語言 正文
const today = new Date();
?? ??? ??? ??? ??? ?const dateArray = [];
?? ??? ??? ??? ??? ?const dayOfWeekArray = [];
?? ??? ??? ??? ??? ?const yearMonthDayArray = [];
?
?? ??? ??? ??? ??? ?for (let i = 0; i < 7; i++) {
?? ??? ??? ??? ??? ??? ?// 獲取時間戳
?? ??? ??? ??? ??? ??? ?const d = new Date(today);
?? ??? ??? ??? ??? ??? ?console.log(d);
?? ??? ??? ??? ??? ??? ?console.log(today);
?? ??? ??? ??? ??? ??? ?console.log(today.getDate());
?? ??? ??? ??? ??? ??? ?console.log(d.setDate(today.getDate()));
?? ??? ??? ??? ??? ??? ?d.setDate(today.getDate() + i);
?? ??? ??? ??? ??? ??? ?console.log(d);
?? ??? ??? ??? ??? ??? ?console.log(d.getDate());
?? ??? ??? ??? ??? ??? ?// 數字
?? ??? ??? ??? ??? ??? ?dateArray.push(d.getDate());
?? ??? ??? ??? ??? ??? ?console.log(dateArray);
?? ??? ??? ??? ??? ??? ?const dayOfWeekStr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][d.getDay()];
?? ??? ??? ??? ??? ??? ?// 星期幾
?? ??? ??? ??? ??? ??? ?console.log(dayOfWeekStr);
?? ??? ??? ??? ??? ??? ?console.log(d);
?? ??? ??? ??? ??? ??? ?console.log(d.getDay());
?? ??? ??? ??? ??? ??? ?dayOfWeekArray.push(dayOfWeekStr);
?? ??? ??? ??? ??? ??? ?console.log(dayOfWeekArray);
?? ??? ??? ??? ??? ??? ?const yearMonthDayStr = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
?? ??? ??? ??? ??? ??? ?// 獲取到幾年幾月幾日
?? ??? ??? ??? ??? ??? ?yearMonthDayArray.push(yearMonthDayStr);
?? ??? ??? ??? ??? ??? ?console.log(yearMonthDayArray);
?? ??? ??? ??? ??? ??? ?console.log(d.getMonth() + 1);
?? ??? ??? ??? ??? ??? ?console.log(d.getMonth());
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?var num = [];
?
?? ??? ??? ??? ??? ?for (let i = 0; i < dateArray.length; i++) {
?? ??? ??? ??? ??? ??? ?if (dayOfWeekArray[i] == '周一') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.mon,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?} else if (dayOfWeekArray[i] == '周二') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.tue,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?} else if (dayOfWeekArray[i] == '周三') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.wed,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?} else if (dayOfWeekArray[i] == '周四') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.thu,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?} else if (dayOfWeekArray[i] == '周五') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.fri,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?} else if (dayOfWeekArray[i] == '周六') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.sat,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?} else if (dayOfWeekArray[i] == '周日') {
?? ??? ??? ??? ??? ??? ??? ?num.push({
?? ??? ??? ??? ??? ??? ??? ??? ?data: dateArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?numa: dayOfWeekArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time: yearMonthDayArray[i],
?? ??? ??? ??? ??? ??? ??? ??? ?time_data: res.data.list.sun,
?? ??? ??? ??? ??? ??? ??? ??? ?color: 'background-color: #EFEFEF;color:black;'
?? ??? ??? ??? ??? ??? ??? ?})
?? ??? ??? ??? ??? ??? ?}
?
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?that.week_inner = num;
?? ??? ??? ??? ??? ?console.log(that.week_inner);
?? ??? ??? ??? ??? ?this.currentTime();
?? ??? ??? ??? ?}
原文鏈接:https://blog.csdn.net/smallmww/article/details/132141909
- 上一篇:沒有了
- 下一篇:沒有了
相關推薦
- 2022-08-04 python中可以發生異常自動重試庫retrying_python
- 2022-05-08 ASP.NET?MVC對URL匹配操作_實用技巧
- 2024-04-07 springmvc接受對象參數和MultipartFile參數的問題
- 2022-05-14 一起來學習React元素的創建和渲染_React
- 2022-12-31 Android入門之onTouchEvent觸碰事件的示例詳解_Android
- 2022-07-07 Linux?shell進行文件解壓,復制和移動詳解_linux shell
- 2023-04-02 python導出requirements.txt的幾種方法總結_python
- 2022-08-20 python?memory_profiler庫生成器和迭代器內存占用的時間分析_python
- 欄目分類
-
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支