I am playing around with DateFormatter in xcode playground to try to learn the basic of how the date object works in swift.
The following code gave my strange results when i tried to print the result from a string to date conversion from this string "050478" (5. April 1978) to a date . In Norway our social security number starts with ddMMyy, so it is that number i want to convert to a date.
import UIKit
let dateFormatterGet = DateFormatter()
dateFormatterGet.dateFormat = "dd/MM/yy"
let myDateString = "05/04/78"
if let myDate = dateFormatterGet.date(from: myDateString)
{
print(myDate)
}
As you can see, the print(myDate) command gives me the wrong date from the day before what i a gave as argument to the dateformatter (1978-04-04)