I think you need to create an NSDateFormatter and call setDateStyle: set it to NSDateFormatterNoStyle, and then only display the time without displaying the date.
NSString *originalString = @"01:23:45"; NSDateFormatter *fromFormatter = [[NSDateFormatter alloc] init]; [fromFormatter setDateFormat:@"HH:mm:ss"]; [fromFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]]; [fromFormatter setTimeZone:[NSTimeZone systemTimeZone]]; NSDate *date = [fromFormatter dateFromString:originalString]; [fromFormatter release]; NSDateFormatter *toFormatter = [[NSDateFormatter alloc] init]; [toFormatter setDateStyle:NSDateFormatterNoStyle]; [toFormatter setTimeStyle:kCFDateFormatterFullStyle]; [toFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Tokyo"]]; [toFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"ja"] autorelease]]; NSString *s = [toFormatter stringFromDate:date]; NSLog(@"s:%@", s); [toFormatter release];
source share