From the debugger it shows that the date string is "2017-08-01 00:00:00" and I passed the correct format too. But the dateFormatter.date part always fail (return nil) for 1 device. But some its working for simulator and other iphone devices. Im using swift3
Asked
Active
Viewed 664 times
5
-
1You may want to look at this [thread](https://developer.apple.com/library/content/qa/qa1480/_index.html) to understand more about why it may not be working in this specific device. – Puneet Sharma Oct 09 '17 at 06:45
-
@PuneetSharma thanks – iadcialim24 Oct 09 '17 at 06:53
1 Answers
10
Try to set your locale:
dateFormatter.locale = Locale(identifier: "en_US_POSIX")

Ayman Ibrahim
- 1,359
- 15
- 24