I'm new to iPhone development and now working on my first app. I have an UIDatePicker on a view and, if the user clicks on save, the current time of the date picker should be saved in the database (in format hh:mm).
Now, the problem is that my UIDatePicker has a 24-hour-format to choose the desired hours and minutes (I configured this by setting the iPhone settings in the simulator to "Switzerland" and "German"). If I choose, for example, 17:00 in the date picker, the following code generates 5:00 in NSLog:
NSDateFormatter *datePickerFormat = [[NSDateFormatter alloc] init];
[datePickerFormat setDateFormat:@"hh:mm"];
NSString *datePickerStringToSave = [datePickerFormat stringFromDate:datePicker.date];
NSLog(@"%@", datePickerStringToSave);
Is it possible that the date picker returns the selected time in 24-hour format? Or can I configure the NSDateFormatter to show the returned time in 24 hours? I already tried to set the "Local" setting in the attributes inspector of the date picker to my country and language, but that doesn't work...
Thanks for your answers!