Time converting problems...

Started by
10 comments, last by jrblkbelt 17 years, 10 months ago
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...
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
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
Quote:I'm not sure what the problem is

Thats apparent.
Quote:in flash using actionscripts
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...
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
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.
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
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...
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

This topic is closed to new replies.

Advertisement