SRL Archive - Web Development

[PHP] Converting Scar Time


rogeruk

2009-08-30 23:36:33

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

2009-08-30 23:38:28

Send it as three separate variables, one for Hours, one for Minutes, and one for Seconds.

rogeruk

2009-08-30 23:54:56

ConvertTime(GetTimeRunning, hours, mins, seconds);

Silly me. Thanks anyways :)

Freddy1990

2009-09-01 19:41:36

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

2009-09-01 20:35:08

Yea thats how i done it, little bit different.

nielskool

2009-09-13 02:34:09

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;