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 |
Returns:
string
{string} 格式化后的日期字符串
模板字符说明: - YYYY/yyyy:年 | MM:月(补零)| M:月(不补零) - DD/dd:日(补零)| D/d:日(不补零) - HH:时(24 小时制,补零)| H:时(不补零) - mm/m:分 | ss/s:秒 | SSS/SS/S:毫秒 - ww/w:中文星期