함수에서 NSDate에 문제가 있습니다. 본질적으로, 포맷팅이 작동하지 않으며, 내가 잘못하고있는 것을보기 위해 또 다른 눈의 세트가 필요합니다.Swift에서 날짜 형식이 작동하지 않습니다. 3
코드 :
@IBOutlet weak var dateField: NSTextField!
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MMMM dd yyyy"
let currentDate = NSDate()
convertedDateString = dateFormatter.string(from:currentDate as Date)
dateField.stringValue = convertedDateString as String
print("convertedDate: ", convertedDateString)
print("dateField.stringValue: ", dateField.stringValue)
결과 :
convertedDate : 2016년 7월 25일
dateField.stringValue : 7/25/16
이 사이트에 따르면 모든 것이 좋습니다 http://nsdateformatter.com/ –
당신의 dateField는 무엇입니까? 포맷터가 올바르게 보인다. – WeiJay
날짜 필드 (그 무엇이든)는 아마도 특정 형식을 요구합니다. – Sulthan