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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:02:01+00:00 2026-06-02T19:02:01+00:00

In my application I need to compare three dates in one if-else cycle. I

  • 0

In my application I need to compare three dates in one if-else cycle. I have a start date, end date and the date of testing. What I want to check is whether the test date is between the start date and end date.

if (testDate >= startDate && testDate <= endDate) {

If I set the startDate to 25/04/2012 and the endDate to 24/04/2019 and the testDate to 25/12/2013 the code works. But if i set the startDate to 26/04/2000 and the endDate to 24/04/2019 and the testDate to 25/12/2013 the code does not works. What’s wrong?

  • 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-06-02T19:02:03+00:00Added an answer on June 2, 2026 at 7:02 pm

    Dates can be compared like that. However, you must first call timeIntervalSince1970 to convert the date to an integer type value. In this case, it gives you a numeric value of type NSTimeInterval.

    The other option is to use the compare: method invoked on the NSDate object.

    In that case, comparing one date to another will give a result detailed in the class reference as follows:

    • The receiver and anotherDate are exactly equal to each other,
      NSOrderedSame

    • The receiver is later in time than anotherDate, NSOrderedDescending

    • The receiver is earlier in time than anotherDate, NSOrderedAscending.

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

Sidebar

Related Questions

I have to write an application, which will compare the modification date of two
I have two android applications that I have developed. I need to compare the
I need to build a mobile application which is able to compare data in
I have a option to attach files within a application. I this I need
I need to compare the performances of a Flask application that uses jinja2.Template.render against
I have an application where I need to use 'Basic Authentication'; however, in order
I have an MFC application where I want a certain method to be called
In my Java application i need to compare two list's element whether it is
I have a small app using Drive.Info. I want to do two things. Check
In the java web application need to select the file from server and print

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.