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 222713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:09:11+00:00 2026-05-11T19:09:11+00:00

I have an NSTimeInterval, and I’d like to know whether that timestamp falls between

  • 0

I have an NSTimeInterval, and I’d like to know whether that timestamp falls between the start and end of a date. Basically I need to be able to do something like:

NSDate *today = [NSDate date];
NSTimeInterval myInterval = someInterval;

[date returnYesIfFallsThisDate:myInterval];

Is there a straight forward method to figure out if my NSTimeInterval falls on the same day as an NSDate object?

Thanks all.

  • 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-11T19:09:11+00:00Added an answer on May 11, 2026 at 7:09 pm

    An NSTimeInterval is just a number of seconds. To compare it to an NSDate, you need to interpret the time interval relative to some reference point, then create an NSDate with the result, then compare the two NSDates.

    There are two standard reference dates: 2001-01-01 and 1970-01-01 (the latter being “UNIX time”). If neither of those is the correct reference date, use NSCalendar to create an NSDate for the correct reference date, then create your NSDate of interest relative to that.

    Now for the comparison.

    If all you care about is the date on the calendar, then you’ll create the NSDate, then use an NSCalendar to get NSDateComponents for the date. Specifically, you’ll get the year, month, and day-of-the-month, then compare those.

    There’s no need to worry about “start” and “end” times; in fact, if you only care about the date on the calendar, you can ignore the time-of-day entirely.

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

Sidebar

Related Questions

I have date, for example: 2012-02-07 14:09:46.109950 and I need timestamp as 1328623786.568740 ,
I have a NSTimeInterval which is basically NSTimeInterval interval = [date1 timeIntervalSinceDate: [NSDate date]];
I have an NSTimeInterval that is stored as a double. I would like to
I have 1 UIViewController. in that i wrote, - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { NSLog(@A); }
I have two instances of NSDate (a start time and an end time) and
I have an entry on a core data entity that represents a NSTimeInterval. First
I have an entry on a core data entity that represents a NSTimeInterval. First
I have an NSTimeInterval value, or more precisely an NSTimeInterval since reference date. I
I have a an application that uses CoreData. One of the entities contains date
I have a set of NSTimeIntervals like this: NSArray *mySet = [NSArray arrayWithObjects: [NSNumber

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.