Jump to content

Converting integers into time


SirChick

Recommended Posts

Hey guys,

 

 

I'm trying to work out how to do something like this:

 

Say you had a number 34. Now i want to convert that to time by making it become 3 hours and 40 minutes.. in a time stamp manner..

 

On top of that say the number rolled above a 6 (suggesting 60 minutes) itll roll on to the next time line like:

 

364 becomes(36 - the 6 rolls over to the 3 so 3+1 = 4) which makes 44 is 4 hours and 4 minutes.

then this would become 4 hours and 40 minutes as the hundred mark infact adds onto hour...

 

How is this done and also put into a time stamp?

Link to comment
https://forums.phpfreaks.com/topic/75296-converting-integers-into-time/
Share on other sites

Try taking a look at http://us.php.net/date

 

Presumably only suggested as a learning resource and not intended as a serious response to the OP's question.

 

I'm with cooldude.  There's no apparent rhyme or reason to your conversions so 'programming' it is impossible.

I talked to them a bit and the idea is the number is

 

H(MM) +1H  so

123 = 2 hours 23 minutes

343 = 4 hours 43 minutes.

 

but numbers like

375 = 5 hours 15 minutes

 

So yes it has no really strong path, but can be done.  I told them a better way and solved it so this is technicaly solved.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.