I’m using the NSDateFormatter to get a string representing the date from my NSDate:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterFullStyle];
return [formatter stringFromDate:date];
The NSDateFormatterFullStyle format is like Tuesday, April 12, 1952 AD. I can easily check if this date is the same year as now (using NSDate-Extensions). If this is the case, I would like the part of the string representing the year to be removed. Is there an easy way to do this?
I didn’t find any solutions for this. I end up searching the string for a year and remove it if it exists.