Jump to content
  • Advertisement
Sign in to follow this  
jrblkbelt

Time converting problems...

This topic is 4526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a countdown clock in flash using actionscripts and I can get the total hours left, the total hours left, and the total minutes left. The only thing is, it's not really a readable time. It's a 3 long numbers and not like "23 days, 12 hours, 14 minutes" which is the format I want it to be... you don't need to know the language I just need a formula to take them from this horrible format and put it into something pleasent looking...

Share this post


Link to post
Share on other sites
Advertisement
so you print the text yourself... in C++

cout << numDays << "days, " << numHours << "hours, " << numMinutes << "minutes\n";

I'm not sure what the problem is if you already have the time broken up into the 3 units of time...

-me

Share this post


Link to post
Share on other sites
so it occurs to me that you mean this:

You have the time in seconds

You want to print it in days/hours/minutes

Which would be your homwork assignment.

Start by thinking about how you'd do that on paper. Then try to work out what you did. You'll want some form of whole number division (i.e. divide by something and drop everything after the decimal point).

-me

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
I'm not sure what the problem is

Thats apparent.
Quote:
in flash using actionscripts

Share this post


Link to post
Share on other sites
Yea, anonyomous is right. I am using actionscript. I just need a formula. Code like that exists in actionscript but that doesn't fix my problem...

Share this post


Link to post
Share on other sites
Quote:
Original post by jrblkbelt
Yea, anonyomous is right. I am using actionscript. I just need a formula. Code like that exists in actionscript but that doesn't fix my problem...


Your problem is unclear. you say that the languange you are using doesn't matter. which of my 2 answers applies to your problem?

You said you want a "formula". There is no "formula" for making the text "X hours, X minutes, X seconds" appear if you already know the number of hours, minutes and seconds. What you want in that case is actionscript code to format strings. In which case your statement about language not mattering is confusing.

If you want to calculate those numbers if you're given only seconds, then yes, you need a formula. But if that's the case, it's likely homework and hopefully no one will just give you an answer.

-me

Share this post


Link to post
Share on other sites
Um... here it might be easier to make a forumla to make X days, X hours, and X minutes if you know the total minutes or seconds, I know that... how bout that? As for trying to figure it out myself, I spent an hour trying to figure it out...

Also, this is not homework. I am a 15 year old trying to learn to progrm on my own... it's difficult but I am trying. I am using this counter as a relese counter on a HaloCE Map my team is making... it's no homework.

Share this post


Link to post
Share on other sites
ok.

how many minutes are in a day?

if you know that, how would you figure out how many days a large number of minutes represents

-me

Share this post


Link to post
Share on other sites
Hm... 1440 mintes in a day... so... I'm still completely lost how to distribute those minutes among the rest of it...

Oh, wait... you'd devide 1440 to find the # of hours...

Share this post


Link to post
Share on other sites
no.

first find the number of days in your block of minutes. forget everything else. so then you have a number of days.

now you have 2 numbers

1) number of days
2) original number of minutes

so you want to figure out what's left in that original number of minutes and then extract the number of hours.

-me

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!