Autor Beitrag
OliverN_26
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Do 06.10.11 15:51 
Hallo Leute

wie es der Betreff schon sagt hab ich ein kleines Problem beim umwandeln eines DATETIME Feldes in meiner Datenbank.

So stehts drin: "2011-10-06 16:45:00"
so solls sein: "06.10.2011 16:45:00"

Wie man das mit DATE Feldern macht weiss ich:
SELECT wonr, DATE_FORMAT(upload_date,GET_FORMAT(DATE,'EUR')) AS 'upload_date' FROM ...

Aber wie binde ich die Zeit da mit ein? Finde da im Netz nichts dazu :-(

Danke
guinnes
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 182
Erhaltene Danke: 14



BeitragVerfasst: Fr 07.10.11 08:45 
Wenn das Feld ein DateTime-Feld ist, kommt der Wert in Delphi auch als TDateTime an ( also als Float ), warum willst du da in der Datenbank was wandeln ?
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Fr 07.10.11 09:44 
Ich lese mit Delphi Werte in die Datenbank und hol sie mit AJAX wieder raus. Und da würde ich das Feld gerne schon beim Select wandeln.
guinnes
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 182
Erhaltene Danke: 14



BeitragVerfasst: Fr 07.10.11 10:12 
Im schlimmsten Fall ein Konstrukt wie :
ausblenden Quelltext
1:
Select Concat(DayOfMonth(DeinFeld),'.',Month(DeinFeld),'.',Year(DeinFeld),' ',Hour(DeinFeld),':',Minute(DeinFeld),':',Second(DeinFeld))					
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Fr 07.10.11 11:21 
Danke :-)
Das klappt wunderbar bis auf ein letztes Problem. ISt die Monats- oder Tagesangabe < 10 fehlt mir die "0" --> 2011-08-15 = 15.8.2011
guinnes
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 182
Erhaltene Danke: 14



BeitragVerfasst: Fr 07.10.11 11:38 
Dann benutze bei den Stellen, die einstellig werden können einfach LPAD:
LPAD(Month(DeinFeld),2,'0') usw.
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Fr 07.10.11 12:26 
Wunderbar :-)
Vielen Dank und ein schönes Wochenende