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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:50:32+00:00 2026-05-25T12:50:32+00:00

In My application I have to complete a particular task in given time.So first

  • 0

In My application I have to complete a particular task in given time.So first i calculated the time complete the task in seconds and then add that time to the current that like this.

NSDate *mydate = [NSDate date];
NSTimeInterval TotalDuraionInSec = sec.cal_time * 60;
TaskCmpltTime = [mydate addTimeInterval:TotalDuraionInSec];
NSLog(@"task will be completed at%@",TaskCmpltTime);

now I compare time like this

if([CurrentTime isEqualToDate:AfterCmpltTime]){
NSLog (@"Time Finish");
}

but I want to know is Time is left or not.Is current time is less then or greater then current time how can i know this ?

  • 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-25T12:50:33+00:00Added an answer on May 25, 2026 at 12:50 pm

    I have an example where I get the time from a picker and check if its today or tomorrow. You should be able to just take the code and use it in your way…

    int selectedHour =  [customPickerView selectedRowInComponent:0];
    int selectedMinute =  [customPickerView selectedRowInComponent:1];
    
    NSDate *today = [NSDate date];
    NSDateFormatter *weekdayFormatter = [[[NSDateFormatter alloc] init]autorelease];
    NSDateFormatter *hmformatter = [[[NSDateFormatter alloc] init]autorelease];
    [hmformatter setDateFormat: @"hh mm"];
    [weekdayFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
    [weekdayFormatter setDateFormat: @"EE"];
    // NSString *formattedDate = [formatter stringFromDate: today];
    
    
    NSCalendar *gregorian = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]autorelease];
    NSDateComponents *dateComponentsToday = [gregorian components:(NSHourCalendarUnit  | NSMinuteCalendarUnit | NSDayCalendarUnit) fromDate:today];
    
    
    NSInteger currentHour = [dateComponentsToday hour];
    NSInteger currentMinute = [dateComponentsToday minute];
    
    NSString *weekday; 
    
    
    
    if ((selectedHour > currentHour) | ((selectedHour == currentHour) & (selectedMinute > currentMinute))) {
        //so we are still in today
        weekday = [weekdayFormatter stringFromDate: today];
        weekday =  NSLocalizedString(@"today", @"today");
    } else {
        //the timer should start tomorrow
        NSTimeInterval secondsPerDay = 24 * 60 * 60;
        NSDate *tomorrow = [today dateByAddingTimeInterval:secondsPerDay];
        weekday = [weekdayFormatter stringFromDate: tomorrow];
        weekday =  NSLocalizedString(@"tomorrow", @"tomorrow");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of codes that are particular to the application (one to
I have application that makes different queries with different results so the caching in
I have complete code for implemention for facebook in my application But the problem
Possible Duplicate: Measure execution time for a Java method I have an application by
I have a WCF service with a client application. I have complete control over
I have a charting application that dynamically generates SQL Server queries to compute values
I have a application that stores passwords in a ms sql database, I wish
I have one application in which list of videos that are coming through xml
I have some wizard-like pages in my application, its keeping state while navigating between
I have a simple MySQL script that I use in a web application to

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.