/** * 本模块提供日期和时间处理的相关方法。 * @packageDocumentation */ /** * 格式化日期。 * @param date 日期对象或时间戳(毫秒)。 * @param formation 格式。 * @return 格式化结果。 * @example * ```javascript * formatDate(new Date(2018, 9, 8, 8, 50, 56), 'YYYY-MM-DD hh:mm:ss'); // '2018-10-08 08:50:56' * ``` */ export declare function formatDate(date: number | Date, formation: string): string; /** * 秒数格式化配置。 */ export interface FormatSecondsOptions { /** * 段数,2、3 或 'auto'。 * 为 3 时,格式化样式为「时:分:秒」。 * 为 2 时,格式化样式为「分:秒」; * 为 'auto' 时,不超过 1 小时按 2 段处理,否则按 3 段处理。 */ segments?: number | 'auto'; /** * 每一段数字的最小位数,不足位数时补 0。 */ digits?: number; } /** * 把秒数格式化成“时:分:秒”格式。 * @param secs 秒数。 * @param options 格式化配置。 * @return 格式化结果。 * @example * ```javascript * formatSeconds(3682); // '61:22' * formatSeconds(82); // '01:22' * formatSeconds(82, { segments: 3 }); // '00:01:22' * formatSeconds(3682, { segments: 3, digits: 1 }); // '1:1:22' * ``` */ export declare function formatSeconds(secs: number, options?: FormatSecondsOptions): string; /** * 把“时:分:秒.毫秒”格式的字符串转换为总秒数。如存在毫秒部分,则四舍五入。 * @param time “时:分:秒.毫秒”格式的字符串。 * @returns 总秒数。 * @example * ```javascript * timeToSeconds('00:01'); // 1 * timeToSeconds('10:01'); // 601 * timeToSeconds('06:10:01'); // 22201 * timeToSeconds('06:10:01.123'); // 22201 * timeToSeconds('06:10:01.666'); // 22202 * ``` */ export declare function timeToSeconds(time: string): number;