was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

46 Visitors Online


 
...TTime für über 24h benutzen?
Autor: Zandy
[ Tip ausdrucken ]  

Tip Bewertung (3):  
     


function TextToTime(S: string): Integer;
var
  
p, i: Integer;
  Sh, Sm, Ss: string;
begin
  
Sh := '';
  SM := '';
  SS := '';
  i  := 1;
  p  := 0;
  while do
  begin
    if 
(s[i] <> ':') then
    begin
      case 
of
        
0: SH := Sh + s[i];
        1: SM := SM + S[i];
        2: SS := SS + S[i];
      end;
    end
    else
      
Inc(p);
    Inc(i);
  end;
  try
    
Result := (StrToInt(SH) * 3600) + (StrToInt(SM) * 60) + (StrToInt(SS))
    except
      
Result := 0;
  end;
end;

function TimeToText(T: Integer): string;
var
  
H, M, S: string;
  ZH, ZM, ZS: Integer;
begin
  
ZH := T div 3600;
  ZM := T div 60 - ZH * 60;
  ZS := T - (ZH * 3600 + ZM * 60);
  if ZH then H := '0' + IntToStr(ZH)
  else
    
H := IntToStr(ZH);
  if ZM then M := '0' + IntToStr(ZM)
  else
    
M := IntToStr(ZM);
  if ZS then S := '0' + IntToStr(ZS)
  else
    
S := IntToStr(ZS);
  Result := H + ':' + M + ':' + S;
end;

 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners