I am trying to get date from week day and year . It work and get correct Output. But when i am changing CalendarIdentifier then it will show wrong output.
Here is my code
when i am setting CalendarIdentifier is NSGregorianCalendar
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setYear:2013];
[components setWeek:2];
[components setWeekday:1];
NSDate *resultDate = [gregorian dateFromComponents:components];
output is :- 2013-01-05 18:30:00 +0000
When i am changing CalendarIdentifier is NSIndianCalendar
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSIndianCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setYear:2013];
[components setWeek:2];
[components setWeekday:1];
NSDate *resultDate = [gregorian dateFromComponents:components];
Output is :- 2091-03-24 18:30:00 +0000
what am i doing wrong ?.. Thanks in advance..
EDIT
According to Midhun MP answer my output is correct.
now my problem is if i am using NSGregorianCalendar
output is :- 2013-01-05 18:30:00 +0000 day of that date is saturday.
According to NSGregorianCalendar saturday is start of week and friday is end of week . I want find similar start and end of week i.e Monday and sunday in india or it is different ??? .