I am trying to remove time from date using NSDateFormatter. This is the code:
func dateWithOutTime( datDate: NSDate?) -> NSDate {
let formatter = NSDateFormatter()
formatter.dateFormat = "dd-MM-yyyy"
let stringDate: String = formatter.stringFromDate(datDate!)
let dateFromString = formatter.dateFromString(stringDate)
return dateFromString!
}
If i send in ex 04-01-2016 12:00:00, the return is 03-01-2016 23:00:00 I have tried changing the dateFormat, but it still keeps to subtracting a day from the date... Why? Please Help :)