Sign in to follow this  
Followers 0
d0n

Turning seconds into min and seconds

4 posts in this topic

say i have 950 seconds what would be the best way to get that in minute and seconds

this is what i have, is there a better way to do this?

$sec = 950

Floor($sec/60)&":"&Ceiling(StringTrimLeft($sec/60,2)*60))

Share this post


Link to post
Share on other sites



I believe this is cleaner.

$input=950
$sec=Mod($input,60)
$min=($input-$sec)/60
MsgBox(0,$input,$min&":"&$sec)

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

ah yes Mod() was the function i was looking for >_

Share this post


Link to post
Share on other sites

or..

$sec = 950
$ticks=$sec*1000
global $hours,$mins,$secs
_TicksToTime($ticks,$hours,$mins,$secs)

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0