I am trying to fetch the currentTime in a 24 hour format with UTC timezone. When I have debugged my app in different devices, I came across a strange problem.
The code works perfectly fine in my device, however it gives time in 12 hour format in my cousin's iPhone having iOS 11.2. So I have tried running app in another device which is iPhone X with same os.
I am not sure what went wrong but then I tried this in few other devices as well and the app runs fine in all other devices. P.S. Older version of my app runs fine in cousin's phone too with the same code.
here is my code which I have used to get currentTime.
let dateFormatter = DateFormatter()
dateFormatter.timeZone = NSTimeZone(abbreviation: "UTC") as TimeZone!
dateFormatter.dateFormat = "EEEE"
dayOfWeekString = dateFormatter.string(from: NSDate() as Date)
dateFormatter.dateFormat = "HH"
let CurrentTime = dateFormatter.string(from: NSDate() as Date)
let CHour = Int(CurrentTime)!
Looking for the solution