4/5 (4 avis)
Snippet vu 8 331 fois - Téléchargée 31 fois
function IntToTime(Valeur:integer):string; var TmpVal:real; TmpStr:string; begin TmpVal := Valeur; TmpStr := ''; TmpVal := TmpVal / 3600000; TmpStr := inttostr(trunc(TmpVal)); TmpVal := (TmpVal-trunc(TmpVal))* 3600000; TmpVal := TmpVal / 60000; TmpStr := TmpStr + ':' + inttostr(trunc(TmpVal)); TmpVal := (TmpVal-trunc(TmpVal))*60000; TmpVal := TmpVal / 1000; TmpStr := TmpStr + ':' + inttostr(trunc(TmpVal)); TmpVal := (TmpVal-trunc(TmpVal))*1000; TmpVal := TmpVal; TmpStr := TmpStr + ':' + inttostr(trunc(TmpVal)); Result := TmpStr; end;
22 mars 2003 à 22:57
Il existe un type TTimeStamp:
TTimeStamp =record
Time:Integer;
Date:Integer;
end;
donc le code :
var T:TTimeStamp;
D:TDateTime;
begin
T.time := 1254586; //millisecondes
D:=TimestampToDateTime(T);
...et plein d'autre fonction ....
end;
en gros, vous reinventez la roue .... il faut lire la doc !!!!
7 mars 2002 à 16:47
Function MilisecondesToTime(D : Integer) : String;
Var
T : TDateTime;
F : Double;
Begin
F := (Frac(D / 1000)) * 1000;
T := D / 86400000;
Result := TimeToStr(T) + ':' + IntTostr(Round(F));
End;
Au fait : http://philippe.gormand.free.fr/
6 mars 2002 à 18:21
Mais comment fait-ton pour avoir les millisecondes ???
Merci @+
6 mars 2002 à 16:40
Function MilisecondesToTime( M : Integer) : String;
Var
T : TDateTime;
Begin
T:=D /86400000;
Result := TimeToStr(T);
End;
// Exemple
procedure TForm1.Button1lick(Sender : TObject);
Var
T : Integer;
begin
T:=GetTickCount;
Caption:= MilisecondesToTime(T);
end;
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.