formatDate(date?
, fmt?
): string
将Date对象或时间戳转换为指定格式的字符串
Name | Type | Default value | Description |
---|---|---|---|
date? |
string | number | Date |
undefined |
日期对象、时间戳或日期字符串 |
fmt? |
string |
'yyyy-MM-dd HH:mm:ss' |
- |
string
格式化后的日期字符串
Description
支持多种日期格式输出,包括年月日时分秒、季度、星期等
Throws
当日期参数无效时抛出
Example