PDA

View Full Version : [PHP] Converting Scar Time



rogeruk
08-31-2009, 03:36 AM
Ive been racking my brains and im stuck lol..

Im trying to convert scars time via PHP. Im sending GetTimeRunning but cant get it to translate into hours, mins and seconds.

Time := (GetTimeRunning) div 1000 div 60;

If i use that then i only get minutes rather than seconds, but i want hours, minutes + seconds.

I cant use TimeRunning because i need to be able to add time together.

senrath
08-31-2009, 03:38 AM
Send it as three separate variables, one for Hours, one for Minutes, and one for Seconds.

rogeruk
08-31-2009, 03:54 AM
ConvertTime(GetTimeRunning, hours, mins, seconds);

Silly me. Thanks anyways :)

Freddy1990
09-01-2009, 11:41 PM
Or send it as 1?
h = floor(ms / 3600000);
ms -= h * 3600000;
m = floor(ms / 60000);
ms -= m * 60000;
s = floor(ms / 1000);

Something like that anyway...

rogeruk
09-02-2009, 12:35 AM
Yea thats how i done it, little bit different.

nielskool
09-13-2009, 06:34 AM
i did:

sec:=(end session-start session(timestamp))*3600*24;
mins:= Trunc((d)/(60));
sec:=d-d2*60;
houres:= Trunc((mins)/(60));
mins:=d2-d3*60;