Return to Snippet

Revision: 23267
at February 2, 2010 21:10 by espinallab


Initial Code
NSDate* date = [NSDate date];

        //Create the dateformatter object

        NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];

        //Set the required date format

        [formatter setDateFormat:@"yyyy-MM-dd"];

        //Get the string date

        NSString* str = [formatter stringFromDate:date];

        //Display on the console

        NSLog(str);

        //Set in the lable

        [dateLabel setText:str];

Initial URL
http://www.roseindia.net/tutorial/iphone/examples/iphone-Objective-c-date.html

Initial Description

                                

Initial Title
Objective c date: NSString Date

Initial Tags

                                

Initial Language
Objective C