How to get the time in am/pm format iphone NSDateFormatter?

后端 未结 8 1098
一生所求
一生所求 2020-12-13 05:44

Am working in an iPhone app with using the NSDateFormatter. Am getting the time from the webservice like \"00:00:00\", \"16:00:00\",\"15:30:00\" and so on. I ne

8条回答
  •  北海茫月
    2020-12-13 06:29

    Swift 5:

    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "hh mm a"
    let formattedDate = dateFormatter.string(from: Date())
    

提交回复
热议问题