I have the following code in my program:
let formatter = DateFormatter()
formatter.dateFormat = "h:mm a"
displayTime = formatter.string(from: timePicker.date)
formatter.dateFormat = "H"
let hour = formatter.string(from: timePicker.date)
print(hour)
When I run this in the simulator, hour comes out to what you'd expect (e.g., 1:30PM in the timePicker --> hour = 13). However, when I run this with my actual phone, the print(hour) in the above case comes out to (1 PM). Why is this happening, and what can I do to fix it?