date - iPhone CoreData: How to group fetched results by day? -


I have a NSDate property called 'time I am developing an iPhone app with CoreData one of my entities' it Time stops in minutes / seconds As my sections, I want to see the date of the day. So if "2010-06-14 8:00 'and' 2010-06-14 11:00 'entries, I want to group them' 2010-06-14 '.

Currently I just do as your Anubagnam using "time":

  NSFetchedResultsController * aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest: fetchRequest managed object Contaks: Manditobjektcontekt Anubagnamkipath: @ "time" Kasnam: @ "root"];  

What is the trick of the group for the time of day? Or do I have to use something like plain SQL and " Group by date (time, '% Y-% m-% d') "?

It this were resolved like:

Added method - ( NSString *) Day; An implementation with my unit class like this:

- (NSString *) day {NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; DateFormatter.dateStyle = NSDateFormatterFullStyle; Return [dateFormatter stringFromDate: self.time]; }

then @ "day" as sectionNameKeyPath as aFetchedResultsController initially @ "Time" (see above).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -