开发者

obj-c : iphone dateformatter in 12-hours clock format

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开发者_Go百科 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"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜