timeLabel.text = (Double(sectionData.receiptTime) ?? 0).jy.dateString(format: "aaa HH:mm")



    /// 将时间戳转化成对应格式字符串
    ///
    /// - Parameter formatterStr: 格式
    /// - Returns: 字符串
    func dateString(format formatterStr: String) -> String {
        let date = Date(timeIntervalSince1970: self.base / 1000.0)
        return date.jy.string(formatter: formatterStr)
    }


    /// 将日期装换成对应的时间字符串
    ///
    /// - Parameter formatStr: 时间字符串的样式,如: yyyy-MM-dd
    /// - Returns: 时间字符串
    func string(formatter formatterStr: String) -> String {
        let format = DateFormatter()
        format.dateFormat = formatterStr
        format.pmSymbol = "下午"
        format.amSymbol = "上午"
        return format.string(from: base)
    }

 

posted on 2020-05-19 14:50  懂事长qingzZ  阅读(752)  评论(0编辑  收藏  举报