项目中经常需要获取特定格式的系统时间,可使用以下方法
static func getDateTime() -> String{
var date = Date.init()
var timeFormatter = DateFormatter.init()
timeFormatter.dateFormat="yyyyMMddHHmmss"
return timeFormatter.string(from: date)
}
项目中经常需要获取特定格式的系统时间,可使用以下方法
static func getDateTime() -> String{
var date = Date.init()
var timeFormatter = DateFormatter.init()
timeFormatter.dateFormat="yyyyMMddHHmmss"
return timeFormatter.string(from: date)
}
本文标题:Swift 获取系统时间
本文链接:https://www.haomeiwen.com/subject/cxhenttx.html
网友评论