Home > sculp-js > formatDate
formatDate() function
格式化为日期对象(带自定义格式化模板)
Signature:
typescript
export declare function formatDate(value: DateValue, format?: string): string;Parameters
Parameter | Type | Description |
|---|---|---|
value | 可以是数值、字符串或 Date 对象 | |
format | string | (Optional) 模板,默认是 YYYY-MM-DD HH:mm:ss,模板字符: - YYYY:年 - yyyy: 年 - MM:月 - DD:日 - dd: 日 - HH:时(24 小时制) - mm:分 - ss:秒 - SSS:毫秒 - ww: 周 |
Returns:
string
{string} 格式化后的日期字符串