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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:13:39+00:00 2026-05-29T19:13:39+00:00

I am building an iOS app which users will be able to enter the

  • 0

I am building an iOS app which users will be able to enter the estimated wait time to get into local bars/restaurants. To increase reliability, I want to be able to track when a user entered the information, and that time to an xml file and then be able to parse the file into a table view (with the previous update) for others to see. The table cell will display the name of the location, an approximate wait time, and when that wait time was entered.

Essentially what I am trying to figure out is how do I format an NSDate (I want it to look like a time for example 10:30 pm) right at the time a user changes the cel. And given a time, how do I find the difference in the current time and the given time?

Thanks

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

    There are a few questions there, none of which really match the title, but here goes 😉

    To get the current time/date:

    NSDate *now = [NSDate date];
    

    To save this, I suggest you store it in NSUserDefaults:

    [[NSUserDefaults standardUserDefaults] setObject:now forKey:@"startTime"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    

    You can load the date again later using

    NSDate *theDate = [[NSUserDefaults standardUserDefaults] objectForKey:@"startTime"];
    

    You can format the date into something human readable using NSDateFormatter, like this:

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"HH:mm"];
    NSString *time = [formatter stringFromDate:theDate]; // returns something like @"10:30"
    

    You can find the difference between two dates using a function like this:

    NSTimeInterval differenceInSeconds = [date1 timeIntervalSinceDate:date2];
    

    Time intervals are in seconds, so to convert that to a useful time, you can divide by 60 to get minutes, divide by 60 again to get hours, etc. So to convert that to a human readable time:

    NSTimeInterval differenceInSeconds = ...
    
    NSInteger totalSeconds = floor(differenceInSeconds);
    NSInteger seconds = totalSeconds % 60;
    NSInteger minutes = totalSeconds / 60;
    NSString *waitTime = [NSString strinWithFormat:@"%i minutes, %i seconds", minutes, seconds];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an iOS app which needs real-time updates from the server, and I'd
I'm diving into iOS development and am building my own alarm clock app to
I'm diving into iOS development. I am building a simple Diary app. I'd like
I am building a phonegap app for iOS which works perfectly and beautifully except
I'm currently building a web app, which is built with Xcode 3.2.5 and iOS
I am building an iPhone app which uses Facebook iOS SDK and Three20. I
I'm building an IOS app that will need to talk to a MySql database
I am currently building an iOS app which utilises GameKit's turn based gaming api's.
I am building an iOS App which displays video streams from a somewhat complex
I'm building an app which is a universal iPhone/iPad app. I'd like to support

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.