ios - NSDateFormatter with NSIslamicCalendar doesn't work correctly -
After
I am changing the Greogorian date to the Hijri date using } If (! _jjriCalendar) {_hijriCalendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSIslamicCalendar]; } Return _giri calendar; } Here I get HijriDate converted to a string: Given that Islamic calendars are difficult apparently in acceptable use But there are different mathematical formulas which are born for different results. In addition, the correct calendar is based on the actual observations of the Moon, depending on your location, gives different results and for example weather (whether new moon is visible in one day, May be dependent on the weather; on a good day a new moon can hardly be difficult, while on a cloudy day it can not be seen). In short, there can be different numbers that all can be "right" I suggest reading more about this subject, as you can and then find out That are the answers you show. NSDateFormatter using a
With the help of NSIslamicCalendar setter form set as the setter
setCalendar the problem is that the result of the Hijri string is always more than the actual date for example one day if we out of today's Greg The code given below will be used to convert the date
18 '|| 1435 which is as wrong as today
17 Rabi '|| 1435 , I have seen many posts for these problems and I tried all possible solutions in those posts, but it does not make any sense !! Here is the heater for the hijriDateFormatter property: - (! _hijriDateFormatter)
(NSDateFormatter *) hijriDateFormatter {{if_hijriDateFormatter = [[NSDateFormatter alloc] init]; } [_hijriDateFormatter setTimeZone: [NSTimeZone systemTimeZone]]; // I have trie also to set the time zone as localTimeZone _hijriDateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier: @ "en_US_POSIX"]; [_hijriDateFormatter setDateFormat: @ "MMMM dd, yyyy"]; [_hijriDateFormatter setCalendar: self.hijriCalendar]; Return_gradientfarmer;
NSString * convertedHijriDate = [self.hijriDateFormatter stringFromDate: GregorianDate];
2014-02-17 09:48:47 +0000 Please help me in these issues, thanks in advance
Comments
Post a Comment