Autor Beitrag
Sidi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47


Delphi XE5 Prof.
BeitragVerfasst: Di 04.03.08 23:35 
Hallo zusammen,

es ist zum Mäusemelken aber ich hänge da fest:

Ich greife mit den MyDac Komponenten auf eine MySQL Datenbank zu, dort ist ein Feld im Format DateTime vorhanden. In diesem Feld ist z.B. folgender Wert:

2008-03-04 20:22:01

wenn ich diesen Wert nun mit fieldbyname('blabla').asstring auslese erhalte ich 04.03.2008 20:22:01

Versuche mit datetimetostr(fieldbyname('blabla').asdatetime) brachten auch keinen Erfolg.

Wie kann ich den Wert original auslesen? Weiß da jemand Rat :?:

Gruß Sidi
Bernhard Geyer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 721
Erhaltene Danke: 3



BeitragVerfasst: Mi 05.03.08 00:09 
Da ignoriert wohl dein MySQL-Query-Tool die Windows-Einstellungen für das Datum.

Dieses lange ISO-Format bekommst du mit:
ausblenden Delphi-Quelltext
1:
FormatDateTime(fieldbyname('blabla').asdatetime, 'yyyy-mm-dd hh:nn:ss')					
Sidi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47


Delphi XE5 Prof.
BeitragVerfasst: Mi 05.03.08 23:46 
Hi,

Danke, das war der richtige Ansatz :oops: , der Formatierungsstring gehört jedoch nach vorne.