2011-11-16 67 views

回答

0

試試這個:

NSDateFormatter *detailsTimeFormatter = [[NSDateFormatter alloc] init]; 
    [detailsTimeFormatter setTimeStyle:NSDateFormatterShortStyle]; 
    NSLog(@"%@",[[detailsTimeFormatter stringFromDate:[NSDate date]] lowercaseString]); // this will return you the time with am/pm 
+0

我想設置的12小時時區以日期選擇器控制器。所以如果你知道給我那個財產。謝謝。 – RJ168

+0

你需要使用NSDateFormatter:'[datePickerFormat setDateFormat:@「HH:mm」];' http://stackoverflow.com/questions/4360402/uidatepicker-return-value-in-24-hour-format 看看指南: http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns – relower

+0

與此我們可以得到該格式的字符串或日期,但我想應用12小時日期格式日期選擇器控制器。 – RJ168

相關問題