I'm trying to create NSDate
containing only today's date, not time. And I don't need any timezone support. Basically just get today's date from the current calendar.
NSCalendar* calendar = [NSCalendar currentCalendar];
// [calendar setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
NSDateComponents* components = [calendar components: (NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)
fromDate: [NSDate date]];
NSDate* today = [calendar dateFromComponents: components];
If I uncomment commented line I get what I need, but if not - I'm getting NSDate object pointing to 7am today's date (I'm in Pacific Time Zone).
Why?