Autor Beitrag
fo3tus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 20.03.07 13:27 
hallo zusammen

ich versuche hier gerade 2 Datums- +Zeitangaben aus einer Textdatei auszulesen und zu vergleichen um die Endzeit heraus zu finden.

also, bestimmte Arbeitsabläufe erstellen Laufzeitprotokolle und ich soll Startzeit und Endzeit ermitteln.
jedoch passt das Format Delphi ganz und gar nicht... und ich bekomme es nicht umgewandelt...
Lese die Zeilen alle in Stringlist und suche mir dann die passenden Zeiten anhand von einer JobID raus.

bsp.: 06-11-27 15:41:00

diese Angabe müsst ich so umwandeln das ich 2 miteinander vergleichen kann...aber ich schaffs nicht...

kann mir wohl wer helfen?
Danke im voraus

lg
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 20.03.07 13:47 
Moin und :welcome: im Forum!

Wenn der Aufbau der Zeitangaben immer gleich ist, dann kannst du doch mit Copy()das Datum so umbauen, wie es StrToDateTimehaben will. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 20.03.07 13:52 
Es ist natürlich schade, wenn man einen PC hat, bei dem die F1-Taste fehlt...

www.delphibasics.co....Name=ShortTimeFormat


Zuletzt bearbeitet von hathor am Di 20.03.07 15:17, insgesamt 1-mal bearbeitet
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4708
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Di 20.03.07 14:57 
Sollte so oder ähnlich funktionieren.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  fs: TFormatSettings;
  d: TDateTime;
begin
  //06-11-27 15:41:00 
  GetLocaleFormatSettings(GetUserDefaultLCID, fs);
  fs.DateSeparator := '-';
  fs.TimeSeparator := ':';
  fs.ShortDateFormat := 'yy-mm-dd';
  fs.ShortTimeFormat := 'hh:nn:ss';
  d := StrToDateTime('06-11-27 15:41:00', fs);


@hathor :
Sehr hilfreicher Kommentar.
Da so ziemlich alles in der Hilfe steht können wir ja das Forum schließen und durch einen großen RTFM Schriftzug ersetzen.

Gruß
Ralf
Hobby-Programmierer
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 238
Erhaltene Danke: 4

Win XP Pro, Vista Ultimate Trial :o)
D6 Pro, D7 Pro, Turbo, XE SE
BeitragVerfasst: Di 20.03.07 15:55 
user profile iconRalf Jansen hat folgendes geschrieben:
Sollte so oder ähnlich funktionieren.

ausblenden Delphi-Quelltext
1:
  TFormatSettings;					

... unbekannter Bezeichner, zumindest in D6! Gibts dafür ne Alternative?

LG Mario
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4708
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Di 20.03.07 16:04 
TFormatSettings steckt in SysUtils. Bestimmt auch schon in D6.
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4708
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Di 20.03.07 16:07 
Eine Mea Culpa an hathor.
Hab den Link auf die Hilfe übersehen und nur den Kommentar gelesen. Sorry
Hobby-Programmierer
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 238
Erhaltene Danke: 4

Win XP Pro, Vista Ultimate Trial :o)
D6 Pro, D7 Pro, Turbo, XE SE
BeitragVerfasst: Di 20.03.07 16:10 
user profile iconRalf Jansen hat folgendes geschrieben:
TFormatSettings steckt in SysUtils. Bestimmt auch schon in D6.

Sicher net, ich schaue schon vorher in die Hilfe bevor ich frage :lol:
Mea Culpa zurück ..., er hat den erst erst nach Deinem Beitrag hinzugefügt!

LG Mario
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4708
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Di 20.03.07 16:50 
Dann hilft vielleich hathors Link.
Aber Vorsicht. Wenn ich micht recht erinnere ändern man die Einstellung Systemweit wenn man an der ShortTimeFormat Variablen dreht. Also nachher schön wieder zurücksetzen.

Gruß
Ralf
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 20.03.07 17:35 
uses DateUtils, // vielleicht hilft's?