How to convert Jan 27, 2557 Buddhist date on January 27, 2013 .
Yes, I know that if I subtract 543 from 2557, I get 2014. However, I want it to be solved using NSDateFormatter.
Here is my code:
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
TimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormatter setTimeZone:timeZone];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSSS'Z'"];
NSDate *gregDate = [dateFormatter dateFromString:buddhistDate];
Thanks.
source
share