Source

ISO 8601 parser/unparser / unparse-ordinaldate.m

Diff from to

File unparse-ordinaldate.m

-#import "NSCalendarDate+ISO8601Parsing.h"
-#import "NSCalendarDate+ISO8601Unparsing.h"
+#import "ISO8601DateFormatter.h"
 
 int main(int argc, const char **argv) {
 	NSAutoreleasePool *pool = [NSAutoreleasePool new];
 
+	ISO8601DateFormatter *formatter = [[[ISO8601DateFormatter alloc] init] autorelease];
+	formatter.format = ISO8601DateFormatOrdinal;
+
 	while(--argc) {
 		NSString *arg = [NSString stringWithUTF8String:*++argv];
-		printf("%s\n", [[NSString stringWithFormat:@"%@:\t%@", arg, [[NSCalendarDate calendarDateWithString:arg] ISO8601OrdinalDateStringWithTime:NO]] UTF8String]);
+		NSTimeZone *timeZone = nil;
+		printf("%s\n", [[NSString stringWithFormat:@"%@:\t%@", arg, [formatter stringFromDate:[formatter dateFromString:arg timeZone:&timeZone] timeZone:timeZone]] UTF8String]);
 	}
 
 	[pool release];