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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:11:00+00:00 2026-06-10T18:11:00+00:00

As it says above… I don’t need the seconds with that as it does

  • 0

As it says above…
I don’t need the seconds with that as it does not constantly update.
I have searched around this site and google for a few hours and couldn’t find anything exactly like what I need.
Here is my code:

//Sets the percentage calculation
double percent = level / 100;
//Calculates the time left while using the following
double a = 40 * percent;
double b = 400 * percent;
double c = 7 * percent;
double d = 6 * percent;

aTime.text = [NSString stringWithFormat:@"%f", a];
bTime.text = [NSString stringWithFormat:@"%f", b];
cTime.text = [NSString stringWithFormat:@"%f", c];
dTime.text = [NSString stringWithFormat:@"%f", d];

After a calculation of, say, 50% of 7 hours, it currently gives 3.5 hours. I want it to say 3:30.

The calculations, as you can see, are static minus the level calculation, I just need to know how to convert the decimal to hh:mm (maybe even days for the 400 hours one).

Note: all the numbers above (40, 400, 7, 6) are in hours.

  • 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-10T18:11:02+00:00Added an answer on June 10, 2026 at 6:11 pm

    Example:

    double hours = 7; 
    double percent = 0.5; // 50 percent
    int value = hours * percent * 60; // value in minutes
    NSString *formatted = [NSString stringWithFormat:@"%02d:%02d",value/60,value%60];
    NSLog(@"%@",formatted);
    

    Output:

    03:30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does the following statement mean? Local and dynamically allocated variables have addresses that
So, just as the title says above is related to the fact that I
Plug-and-Play BIOS spec says that if you have a PnP BIOS, it can configure
I'm missing something here... I have this command: $xpath->query('//input')->item(0) The php.net documentation says that
I have an app that I've been working on, but now I need to
says if i develop a Ruby on Rails application using Rails 2.3.2, will that
Firefox says they support 128px cursors, but that you must keep within 32x32px for
MDN says : Any SVG elements within a foreignObject will not be drawn, except
Question says it all. I tried browsing through the latest tag but could not
I have some Ajax that has been working on a live site, now it

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.