DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

IPhone Date Formatting

02.02.2009
| 5118 views |
  • submit to reddit
        // iPhone uses LDML standard for date formatting: http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns
	//Format Date
	NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
	[dateFormat setDateFormat: @"yyyy-MM-dd HH:mm:ss zzz"]; // 2009-02-01 19:50:41 PST
	NSString *dateString = [dateFormat stringFromDate: [scoreData objectForKey: @"date"]];