Skip to main content

Posts

Showing posts with the label nsdateformatter

how to split strings in objective c

How to split a string in objective-C? I am working on an short application that contains a date picker. I do display date get it from date picker and display it through a label. My main question is that how can I split the the date in to three separate strings? any one has idea about it? thanks Muhammad Naveed

NSDateFormatter"s init method is deprecated?

Per http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html The init method of NSDateFormatter is "Available in iPhone OS 2.0 through iPhone OS 3.2", and therefore not in 4.0. Now, it certainly works, but this seems odd. Is this is a mistake or is there some other way to create a NSDateFormatter ?

NSDateFormatter returning nil in OS 4.0

I had the following code working on on OS 3.x NSString *stringDate = @"2010-06-21T20:06:36+00:00"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; NSDate *theDate = [dateFormatter dateFromString:stringDate]; NSLog(@"%@",[dateFormatter stringFromDate:theDate]); but now in the newest xcode 3.2.3 under the iOS4 simulator, the varialble theDate is nil. I have looked through the class reference and do not see anything deprecated or implemented differently for iOS4 with these specific methods. What did i leave out?