Remove year from NSDateFormatterFullStyle string

I have searched for this question and didn’t find a conclusive and elegant solution. Is there anyway to change the NSDateFormatterFullStyleyear to suppress year information. I’m using the code:

    NSString *dateDescription;
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
    [dateFormatter setTimeZone:gmt];
    [dateFormatter setDateStyle:NSDateFormatterFullStyle];
    dateDescription = [dateFormatter stringFromDate:date];
    NSLog(@"%@", dateDescription);

The result: Wednesday, March 13, 2013

  • What happens to JavaScript execution (settimeout, etc.) when iPhone/Android goes to sleep?
  • iOS/C: Convert “integer” into four character string
  • No identities were available - administrator request
  • What's the difference between static cells and dynamic prototypes?
  • Horizontal scroll using Swift
  • CLLocationManager Delegate methods are not getting called
  • Regards,

    Solutions Collect From Internet About “Remove year from NSDateFormatterFullStyle string”

    The following is the closest you will get without lots of tricky string processing. The call to dateFormatFromTemplate:options:locale: will update the supplied template to best match the specified locale.

    This assumes that the normal “Full” style gives you the weekday name, month name, and day of the month.

    NSString *fullMinusYear = [NSDateFormatter dateFormatFromTemplate:@"EEEE, MMMM dd" options:0 locale:[NSLocale currentLocale]];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:fullMinusYear];
    NSString *dateDescription = [dateFormatter stringFromDate:date];