Swift: Compare date by days
问题 I try to compare two days ignoring time. So I use calendar.compare(date1, to: date2, toGranularity: .day) BUT when transfering the string date to Date type, it is transformed to UTC. So it will be "moved" from 1.1.2016 0:05 to 31.12.2015 11:05 pm. When comparing daywise, this includes only the remaining hour. Before conversion it was 24 hours. Any idea to handle this issue without much effort? Additionally: The code: var dateFormatter = DateFormatter() dateFormatter.dateFormat = "dd-MM-yyyy