UNPKG

@ni-web-infra/common-utils

Version:
39 lines (38 loc) 1.02 kB
/** * 日期时间格式模板 */ export declare const DATE_FORMATTER: { YEAR_FORMAT: string; MONTH_FORMAT: string; DATE_FORMAT: string; HOUR_FORMAT: string; MINUTE_FORMAT: string; SECONDS_FORMAT: string; }; /** * 日期时间格式化为字符串 * @function formatDatetime * * @param {string | Date} v 日期时间 * @param {string} format 日期时间格式 * @returns {string} 日期时间字符串 * * @example * const date = new Date(); * const strDate = formatDatetime(date, 'YYYY-MM-DD HH:mm:ss'); * console.log('日期时间', strDate); */ export declare const formatDatetime: (v: string | Date, format?: string) => string; /** * 日期时间格式化为13位timestamp * @function formatTimestamp * * @param {string | Date} v 日期时间 * @returns {number} 13位timestamp * * @example * const date = new Date(); * const numDate = formatTimestamp(date); * console.log('日期时间', numDate); */ export declare const formatTimestamp: (v: string | Date) => number;