Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7532983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:36:34+00:00 2026-05-30T05:36:34+00:00

I am using core data to store objects for my project.There is a date

  • 0

I am using core data to store objects for my project.There is a date field in the object .I want to check against the clicked date of the Tapku calendar component for iphone. The date on my object is in the format

2011-01-10 and it is a localized date .

How can i check the date against the date returned from the tapku calendar control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:36:35+00:00Added an answer on May 30, 2026 at 5:36 am

    Yes you can, here is what I did to make it work:

    on the method: (NSArray*)calendarMonthView:(TKCalendarMonthView *)monthView marksFromDate:(NSDate *)startDate toDate:(NSDate *)lastDate

    • Make the normal core data fetch to get an array of objects
    • Start checking every day from startDate to lastDate with the [NSArray indexesOfObjectsPassingTest:] method
    • For all that passes the test add and object to the marks array and add a dictionary with the tested day as key and the fetched objects as values

    WARNING: make sure you cast your NSDate objects to a no time and GMT:0 dates in order to make the day comparison to work (learned this the hard way…)

    Here is some code…

    self.marksArray = [NSMutableArray array];
    self.dataDictionary = [NSMutableDictionary dictionary];
    
    NSCalendar *cal = [NSCalendar currentCalendar];
    [cal setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
    
    NSDateComponents *comp = [cal components:(NSMonthCalendarUnit | NSMinuteCalendarUnit | NSYearCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit | NSHourCalendarUnit | NSSecondCalendarUnit) fromDate:start];
    
    NSDate *ds = [cal dateFromComponents:comp];
    
    // Init offset components to increment days in the loop by one each time
    NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
    [offsetComponents setDay:1];
    
    
    while (YES) {
        // Is the date beyond the last date? If so, exit the loop.
        // NSOrderedDescending = the left value is greater than the right
        if ([ds compare:end] == NSOrderedDescending) {
            break;
        }
    
        NSIndexSet *indexes = [arrayWithObjectsFromCoreData indexesOfObjectsPassingTest:
                               ^BOOL (id el, NSUInteger i, BOOL *stop) {
                                   NSDate *upd = [(YOUR_ENTINY *)el updated];
    
                                   NSDate *day=[self midnightUTC:upd]; 
                                   if([ds isSameDay:day]){ 
                                       return TRUE;
                                   }
                                   return FALSE;
                               }];
    
    
    
        if (indexes.count>0) {
    
            [self.marksArray addObject:[NSNumber numberWithBool:YES]];
            [self.dataDictionary setObject:[wods objectsAtIndexes:indexes] forKey:ds];
    
    
        }else {
            //no wods in this date
            [self.dataArray addObject:[NSNumber numberWithBool:NO]];
        } 
    
        // Increment day using offset components (ie, 1 day in this instance)
        ds = [cal dateByAddingComponents:offsetComponents toDate:ds options:0];
    
    
    
    }
    [offsetComponents release];
    

    The midnightUTC method can be found here:
    http://www.voidasterisk.org/post/4209842795/how-to-calculate-nsdate-of-midnight-in-ios

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Core Data to store lists of data. So, there's parent objects with
I've got about 5000-7000 objects in my core data store that I want to
I am fetching a set of objects from a Core Data persistent store using
I have an application using Core Data and bindings. I want to have an
I am using Core Data and want a Text Label to display how many
Using Core Data w/a sqlite store on iPhone.... I've got a bunch of comic
My app is using an NSFetchedResultsController tied to a Core Data store and it
I am using a custom NSValueTransformer to store color information in my Core Data
I'm having a really confounding problem using Core Data. In my Core Data store,
What's the best way to implement runtime filtering of Core Data objects using NSFetchedResultsController?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.