日期计算
解析
{{dayjs()}}
{{dayjs('1995-12-25')}}
{{dayjs(1318781876406)}}
{{dayjs(new Date(2018, 8, 18))}}
{{dayjs().clone()}}
{{dayjs().isValid()}}
获取
{{dayjs().year()}}
{{dayjs().month()}}
{{dayjs().date()}}
{{dayjs().day()}}
{{dayjs().hour()}}
{{dayjs().minute()}}
{{dayjs().second()}}
{{dayjs().millisecond()}}
设置
{{dayjs().set('month', 6).month()}}
{{dayjs().set('second', 30).second()}}
{{dayjs().set('hour', 4).hour()}}
操作
{{dayjs().add(1, 'day').format('YYYY年M月D日 HH:mm:ss')}}
{{dayjs().subtract(7, 'year').format('YYYY年M月D日 HH:mm:ss')}}
{{dayjs().startOf('year').format('YYYY年M月D日 HH:mm:ss')}}
{{dayjs().endOf('month').format('YYYY年M月D日 HH:mm:ss')}}
显示
{{dayjs().format('YYYY-M-D HH:mm:ss')}}
{{dayjs().diff(dayjs().subtract(1, 'day'), 'days')}}
{{dayjs().valueOf()}}
{{dayjs().unix()}}
{{dayjs().daysInMonth()}}
{{dayjs().toDate()}}
{{dayjs().toArray()}}
{{dayjs().toJSON()}}
{{dayjs().toISOString()}}
{{dayjs().toString()}}
{{dayjs().toObject()}}
查询
{{dayjs().isBefore(dayjs().add(1, 'day'))}}
{{dayjs().isBefore(dayjs().subtract(1, 'day'))}}
{{dayjs().isSame(dayjs())}}
{{dayjs().isSame(dayjs().add(1, 'day'))}}
{{dayjs().isAfter(dayjs().add(1, 'day'))}}
{{dayjs().isAfter(dayjs().subtract(1, 'day'))}}