Function timestampToDate

  • 将时间戳(毫秒或秒)转换为日期字符串

    Parameters

    • timestamp: string

      时间戳(毫秒或秒)

    • format: string = 'YYYY-MM-DD HH:mm:ss'

      自定义日期格式,默认为 'YYYY-MM-DD HH:mm:ss'

    Returns string

    返回对应的日期字符串,如果转换失败,返回原时间戳