Initializing a Calendar
suggest change- initWithCalendarIdentifier: initializes a newly allocated NSCalendar for the calendar specified by a given identifier.
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSLog(@"%@", calendar);
- setFirstWeekday: Sets the index of the first weekday for the receiver.
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
[calendar setFirstWeekday:1];
NSLog(@"%lu", (unsigned long)[calendar firstWeekday]);
- setLocale: Sets the locale for the receiver.
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
[calendar setLocale:[NSLocale currentLocale]];
NSLog(@"%@", [calendar locale]);
- setMinimumDaysInFirstWeek: Sets the minimum number of days in the first week of the receiver.
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
[calendar setMinimumDaysInFirstWeek:7];
NSLog(@"%lu", (unsigned long)[calendar minimumDaysInFirstWeek]);
- setTimeZone: Sets the time zone for the receiver.
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
[calendar setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
NSLog(@"%@", [calendar timeZone]);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents