I have a UIDatePicker that is set to fr_FR so I have on the weel the numbers from 00 to 23. When I select an hour I get the English format, if I pick , let's say, 19 , I would like to get 19:00 on the screen, but I get 07:00.
may be prob in your dateformate you setdateformat:#"hh:mm" check as a bellow link
[datePickerFormat setDateFormat:#"HH:mm"];
check the bellow link may be its help more
Setting NSDate in a "TimePicker" with 24 - 12 hours format xcode
Related
Can't find a pattern for this date. Could anyone help me?
I know it's ISO 8601 standart.But everything I have found was without : between 03 and 00.
2018-01-18T08:40:00+03:00
How do I can parse this to Thu Jan 18 00:00:00 GMT+03:00 2018 to this 2018-01-18T08:40:00+03:00?
It looks like this W3C Datetime format is typically used for < lastmod > timestamps in XML.
related & more detailed answer here
Hello i am using the Handsontable library and i have a problem.
I cant find anyway to configure the date Picker to start counting after the first Thursday of the year.
As a result i get a week more than i should.
I get week 27 instead of week 26 for 29-06-2016.
Anyone has a suggestion?
You will use the ISO 8601 format. In Pickaday you have to set the option "showWeekNumber" to "true". The default is "false"
I've read a many things about parsing date in obj-c, but I can't find anything dealing with dates like "Mon, 25 Apr 2011 11:53 am CDT"... I'd like to convert it to NSDate in a smart way but I'm running out of ideas.
Thanks.
-[NSDateFormatter dateFromString:]
You'd probably use #"EEE, d MMM yyyy hh:mm a zzz" as your date format string.
And by the way, googling "convert string to date objective-c" yields thousands of hits that have correct answers.
NSDateFormatter is a pretty complete class that covers all "human-friendly" date scenarios.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html
There's also several questions on stackoverflow that seem very similar to your question, so a quick search should help you out.
Please tell me how to convert time to 12 hr format..
I have a string which i have converted to date but it is in 24 hr format....
You could use the 24 hour clock format instead of the 12 hour format. So use a NSDateFormatter with H in the format string. Using one of the predefined formats will end up using your systems localization which probably is the 12 hour format.
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setDateFormat:#"HH:mm"];
another solution is presented here using regex:
24hr to 12hr time convert, insert character to string
considering you have an hour int named time...
if (time>12)
time=time-12;
When you say you've converted it to a date, what do you mean? Do you mean you have it in an NSDate object? If so, the date is not in 24hr date format. NSDate does not concern itself with how the date will look on-screen.
The formatting comes from your localisation settings. Which is how it should be. I don't want times in 12hr format any more than you want them in 24hr.
But to directly answer the question, you may have to write your own formatting code if you want to override the defaults. I had to do this to work around bugs in NSDateFormatter when I received dates from a third party data source.
To change the date format from 12 to 24 hours or from 24 to 12 simply change hh:mm to HH:mm format where h is for 12 hours and H is for 24 hours.
Remember to change your location.
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:#"HH:mm"];
i want in my application to use the 12 hour clock format so the user can write 15:00
for 3:00 pm so i don't need to create a button am and pm. Thanks
Probably you want to use the 24 hour clock format instead of the 12 hour format. So use a NSDateFormatter with H in the format string.
Using one of the predefined formats will end up using your systems localization which probably is the 12 hour format.
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setDateFormat:#"HH:mm"];