NSDateComponents components:fromDate and Time Zones
问题 I have a method which extracts the hour and second components form a NSDate by breaking it down into its NSDateComponents. My code is as follows... unsigned hourAndMinuteFlags = NSHourCalendarUnit | NSMinuteCalendarUnit; NSCalendar* calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [calendar setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]]; NSDateComponents* travelDateTimeComponents = [calendar components:hourAndMinuteFlags fromDate:travelDate]; NSString* hours