classfuncfromDateToString(date:Date) ->String{
letdformatter =DateFormatter()
dformatter.dateFormat="yyyy年MM月dd日HH:mm:ss"
letdateStr = dformatter.string(from: date)
returndateStr
}
classfuncfromStringToDate(string :String) ->Date{
letdformatter =DateFormatter()
dformatter.dateFormat="yyyy年MM月dd日HH:mm:ss"
letdate = dformatter.date(from: string)
returndate!
}
网友评论