let dates = this.$dayjs().toDate() //Mon May 15 2023 10:19:08 GMT+0800 (中国标准时间)
console.log(dates,'----------------获取当前时间--------------')
// years, months, days, hours, minutes, seconds
let nowdate = this.$dayjs(dates).subtract(1, 'years').format('YYYY年MM月DD')
console.log(nowdate,'减一年日期')//2022年05月15
let nowdate_1 = this.$dayjs(dates).add(1, 'years').format('YYYY年MM月DD')
console.log(nowdate_1,'加一年----------')//2024年05月15
let ChinaT = this.$dayjs(dates).locale('zh-cn').format('h:mm:ss a')
console.log(ChinaT,'ChinaT,汉化----//xx:xx:xx 下午')//10:21:06 am
dayjs 時間の処理
おすすめ
転載: blog.csdn.net/weixin_54368936/article/details/130679361
おすすめ
ランキング