press-ui
Version:
简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目
21 lines (20 loc) • 470 B
TypeScript
/**
* 将时间戳格式化
* @param {number} timestamp
* @param {string} fmt
* @param {string} [defaultVal]
* @returns {string} 格式化后的日期字符串
* @example
*
* const stamp = new Date('2020-11-27 8:23:24').getTime();
*
* const res = timeStampFormat(stamp, 'yyyy-MM-dd hh:mm:ss')
*
* // 2020-11-27 08:23:24
*/
export declare function timeStampFormat(
timestamp: number,
fmt: string,
defaultVal?: string,
whitePrefix?: string
): string;