iview選擇月份 月初月末 時間戳格式

2021-10-12 02:22:55 字數 1075 閱讀 1178

本文記錄的幾個要點

1、結束時間不得比開始時間提前

2、當前月份之後不可選

3、開始時間為當月的第一天 eg: 01月01日 00:00:00

結束時間為當月的最後一天 eg: 12月31日 23:59:59

轉化為時間戳格式入參

4、預設展示向前推12個月

eg: 2019-12 ~ 2020-12

效果圖:(當前月份12月)

**實現:

data() , // 開始時間校驗

endtimeoption: }}}

methods: 

}this.disabled = false

this.templeft = gettime(starttime + '-01 00:00:00')

if (this.tempright && this.templeft) this.monthactive(1)

},// 結束日期

onendtimechange (endtime, type)

}// endtime返回 2020-12

var y = endtime.substring(0, 4)

var m = endtime.substring(5, 8)

this.tempright = gettime(getdate('yyyy-mm-dd 23:59:59', new date(y, m, 1 - 1).gettime()))

if (this.tempright && this.templeft) this.monthactive(1)

}} // 入參

monthactive (pageindex)

deviceonlinedata(data).then().catch()

}

created()

當月月初月末時間戳

1 月初月末時間戳 2 y 2016 獲取年,示例,真實環境從前端獲取資料 3 m 12 獲取月,示例,真實環境從前端獲取資料 4 month y.m 當前年月 5 month start strtotime month 指定月份月初時間戳 6 month end mktime 23,59,59,d...

SqlServer分組取一瓢和月初月末

最近發現乙個小問題,在以前版本大量迭代中,為了實現各種資料顯示,不得不採用分組來顯示我們想要的資料,這個資料有什麼特點呢?這裡大致的分兩種,第一種分組取不同資料列滿足要求 第二種分組取不同資料且列符合要求的完整資料 這兩種都有乙個共同特點 通過分組顯示不能分組的列,且保證資料正確,下面我們分別來分析...

python 獲取當前月份月初日期和月末日期

使用time模組的time.localtime 獲取當前日 期,使用calendar模組calendar.monthrange的來獲取指定月份的天數 即可得到月初日期和月末日期,如下 import calendar import time day now time.localtime day beg...