如何将波斯date转换为xcode中的公历date?

我如何在Xcode中将波斯语date转换为公历date?

请注意,我想转换我的波斯date,并获取格雷戈里date结果在ULAlert视图不在NSLog中显示如何

这是你想要的吗?

NSDateFormatter *df = [[NSDateFormatter alloc] init]; df.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSPersianCalendar]; df.dateStyle = NSDateFormatterMediumStyle; df.dateFormat = @"yyyy/MM/dd"; NSString *stringDate = @"1391/04/07"; NSDate *date = [df dateFromString:stringDate]; NSLog(@"Date %@", date); df.calendar = [NSCalendar currentCalendar]; // or this one if ur current calendar is not GregorianCalendar [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] NSString *stringDateConverted = [df stringFromDate:date]; [[[UIAlertView alloc] initWithTitle:nil message:stringDateConverted delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];