getting hour component from an NSDate
问题 I'm trying to get the hour component from an NSDate . Here is what I do: NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [calendar setTimeZone:[NSTimeZone timeZoneWithName:@"GMT+1"]]; NSDateComponents *startComponents = [calendar components:DATE_COMPONENTS fromDate:_start]; startComponents.timeZone = [NSTimeZone timeZoneWithName:@"GMT+1"]; int hours = [startComponents hour]; Now before yesterday the hours value always was one hour ahead. But since