views:

38

answers:

1

I am having a date as 2010-08-02 which is 2nd August 2010 now i want to dispaly this as Monday,8 August ,2010
Thanks for the help

+1  A: 

You should take a look at NSDateFormatter and if neccessary create your own formatter from a String like in the second link (The last listing).

http://developer.apple.com/iphone/library/documentation/cocoa/reference/foundation/Classes/NSDateFormatter_Class/Reference/Reference.html

http://developer.apple.com/iphone/library/documentation/cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html

NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setDateFormat:@"yyyy-MM-dd"];
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"EEEE',' d MMMM yyyy"];

NSDate *date = [inputFormatter dateFromString:@"2010-08-02"];
NSString *dateString = [outputFormatter stringFromDate:date];
NSLog(@"%@", dateString);

[inputFormatter release];
[outputFormatter release];
nacho4d
ya thanks it really worked
mrugen