Skip to content
On this page

dateFormatter 日期格式化

javascript
//日期格式化
import { getCurrentInstance } from "vue";
const { proxy } = getCurrentInstance();
proxy.$util.dateFormatter.formate("2022/09/08", "yyyy-mm-dd hh:mm");
1
2
3
4

formateType

名称示例
yyyy-m2022-1
yyyy-m-d2022-1-1
yyyy-m-d h:m2022-01-01 1:1
yyyy-m-d hⓂ️s2022-01-01 1:1:1
yyyy-mm2022-01
yyyy-mm-dd2022-01-01
yyyy-mm-dd hh:mm2022-01-01 01:01
yyyy-mm-dd hh:mm:ss2022-01-01 01:01:01
date2022-01-01
datetime2022-01-01 01:01:01

methods

名称描述参数
formate格式化时间(日期,formateType)
now获取当前时间并格式化formateType
getMonthLength获取月份天数(year,month)
calculateDate计算日期(日期, type 增减类型 年:1,月:2,日:3, 数量 ,formateType)