我想用标签(不是日历)显示今天(希伯来日期)的日期。
我如何使用NSDate
?
谢谢!
答案 0 :(得分:2)
答案 1 :(得分:1)
使用它来格式化日期:
NSLocale *hebrew = [[NSLocale alloc] initWithLocaleIdentifier:@"he_IL"];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
format.locale = hebrew;
[format setDateFormat:@"MMM dd, yyyy HH:mm"];
NSDate *now = [NSDate date];
NSString *today = [format stringFromDate:now];
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(30, 40, 240, 30)];
lbl.text = today;
NSLog(@"today: %@", today);