2013-01-10 49 views
0

我建立标签的日期为今日(希伯来语日期)转换数在希伯来语日期字符

工作,但数量,而不是性格

为exapmle:28/4至28 Tavat

代码:

NSLocale *hebrew = [[NSLocale alloc] initWithLocaleIdentifier:@"he_IL"]; // Hebrew, Israel 
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSHebrewCalendar]; 
NSDate *today = [NSDate date]; 
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; 
dateFormat.locale = hebrew; 
dateFormat.calendar = calendar; 
[dateFormat setDateStyle:NSDateFormatterShortStyle]; 
NSString *dateString = [dateFormat stringFromDate:today]; 
[_label setText:dateString]; 

NSDateFormatter * formatter = [[NSDateFormatter alloc] init]; 
[formatter setDateStyle:NSDateFormatterLongStyle]; 
[formatter setTimeStyle:NSDateFormatterNoStyle]; 

NSLog(@"hebrew: %@", [formatter stringFromDate:[NSDate date]]); 
[formatter release]; 

回答

0

您需要的样式改变为中等或更高:

[dateFormat setDateStyle:NSDateFormatterMediumStyle]; 

如果您使用介质的风格,那么每月将缩写,切换到长样式(NSDateFormatterLongStyle)为完整的月份名称。