Objective-C: Unicode Date Format

I am trying to figure out how to get an idea of ​​UNICODE Sun, 03 May 2009 19:58:58 -0700 as eee, dd MMM yyyy HH: mm: s ZZZZ or something else. It seems I'm not sure if this works.

+6
objective-c unicode nsdate nsdateformatter
source share
1 answer

Use NSDateFormatter . It allows you to set a specific format string using format specifiers from the Unicode spec , then get the formatted date from the given NSDate using stringFromDate:. Also consider reading an Apple document on formatting dates . Example:

// Given some NSDate *date NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; [formatter setDateFormat:@"eee, dd MMM yyyy HH:mm:ss ZZZZ"]; NSString *formattedDate = [formatter stringFromDate:date]; 
+14
source share

All Articles