I want to save the date / time in a CoreData repository without seconds or milliseconds. (I do some processing to round the time, and stray seconds / milliseconds become the monkey key.) This is easy enough to drop the seconds:
NSDate *now = [NSDate date];
NSDateComponents *time = [[NSCalendar currentCalendar]
components:NSHourCalendarUnit | NSMinuteCalendarUnit
| NSSecondCalendarUnit fromDate:now];
NSDate *nowMinus = [now addTimeInterval:-time.second];
This works fine to reset seconds, but I cannot find NSMillisecondCalendarUnit, which I could use to reset milliseconds, and I need to. Any ideas? Thank.
source
share