Function parseTime

  • Parse the time to string

    Parameters

    • time: TimeLike

      时间

    • Optionalformat: string = '{y}-{m}-{d} {h}:{i}:{s}'

    Returns null | string

    // 示例 1: 不指定格式
    parseTime(1741785818632); // 输出: 2025-03-12 21:23:38
    // 示例 2: 指定格式
    parseTime('1741785818632', '{y}-{m}-{d}') // 输出: 2025-03-12