跳到主要内容

describeCron()

function describeCron(expression): string;

Defined in: cron/describeCron.ts:165

将 cron 表达式翻译为中文自然语言描述 支持标准 5 段格式(分 时 日 月 周)和 6 段格式(秒 分 时 日 月 周)

Parameters

ParameterTypeDescription
expressionstringcron 表达式字符串

Returns

string

中文描述

Example

describeCron('* * * * *'); // '每天 每分钟 执行'
describeCron('0 9 * * 1-5'); // '每个工作日 09:00 执行'
describeCron('0 0 1 1 *'); // '1月 每月 1 号 00:00 执行'