Autor Beitrag
Bronstein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 578
Erhaltene Danke: 1

WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
BeitragVerfasst: Do 27.07.06 15:35 
Habe einen String im Format „dd:hh:mm:ss“, diesen möchte ich jetzt in Sekunden umrechnen, gibt es hierfür eine Funktion bzw. hat sich jemand schon mal eine geschrieben.

_________________
Es gibt keine dummen Fragen nur dumme Antworten!!!
crowley
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 406

Win XP, Win Vista, Mandriva, Ubuntu
Delphi 4-8, Delphi 2006, Delphi 2007
BeitragVerfasst: Do 27.07.06 15:41 
dafür gibt es keine fertige funktion... aber die hast du auch ruckzuck selber geschrieben...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
function formattedstringtosec(s: string) : cardinal;
begin
  result := StrToInt(copy(s, 1, 2)) * 24 * 60 * 60
          + StrToInt(copy(s, 4, 2)) * 60 * 60
          + StrToInt(copy(s, 7, 2)) * 60 
          + StrToInt(copy(s, 10, 2));
end;


ungefähr so müsste es hinhauen... hab es nicht getestet sondern nur hier reingeschrieben