1

I have no idea what is going on. I am using XCode 8.2.1.

I have method that returns String of current date.

    static func getCurrentDate() -> String {

    let date = Date()

    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "dd.MM.YYYY"
    let dateString = dateFormatter.string(from: date)

    return dateString
}

Now everything look ok, and it is ok, when I run my application in Simulator. But, when I run app on my device I get weird results. This started happening few days ago and I have no idea what is going on.

The output in console is:

dateString  String  "29.12.2017"    
date    Date    2016-12-29 09:38:45 UTC 

You can notice that dateString has year 2017 instead of 2016.

Any idea what is going on?

Excalibur
  • 93
  • 1
  • 9

0 Answers0