AW: Datum umwandeln..
Zitat:
Du hast diesem noch garnichts zugewiesen ... da hannst'e froh sein, daß hier rein zufällig ein Wert drinsteht, der eine ungültige Jahreszahl darstellt. |
AW: Datum umwandeln..
Eine Konstante ist konstant. Man kann an sie nichts mehr anhängen
|
AW: Datum umwandeln..
Ich Volldepp.
hätte dem jahr schon noch nen genauen Wert zuweisen sollen.
Delphi-Quellcode:
DecodeDate(now, jahr, monat, tag);
|
AW: Datum umwandeln..
Delphi-Quellcode:
könnte mir bitte nochmal jemand erklären was hier alles geschieht, einiges ist mir noch nicht wirklich klar. Schließlich sollte man den Code vestehen, den man verwendet!!!
Anzeige := ' von ' + FormatDateTime( 'dd.mm.yyyy', von) + ' bis ' + FormatDateTime( 'dd.mm.yyyy', bis);
Anzeige := SDatumVon + ' ' + DateToStr(von) + SDatumBis + ' ' + DateToStr(bis); SDatum := 'Datum von: %s' + #13#10 + ' bis: %s'; Anzeige := Format(SDatum, [DateToStr(von), DateToStr(bis)]); Aktueller Stand:
Delphi-Quellcode:
const
SDatumVon0101 = 'Datum von 01.01.'; SDatumBis3112 = 'Datum bis 31.12.'; SDatumVon = 'Datum von'; SDatumBis = ' bis'; .... procedure TfrmUmwandeln.Button1Click(Sender: TObject); var jahr, monat, tag: Word; von, bis: TDate; Anzeige: String; SDatum: String; sDatumVon, SDatumBis: String; begin pnlPrjConst.Visible := True; decodedate(now, jahr, monat, tag); von := EncodeDate( jahr, 1, 1); bis := EncodeDate ( Jahr, 12, 31); Anzeige := ' von ' + FormatDateTime( 'dd.mm.yyyy', von) + ' bis ' + FormatDateTime( 'dd.mm.yyyy', bis); Anzeige := SDatumVon + ' ' + DateToStr(von) + SDatumBis + ' ' + DateToStr(bis); SDatum := 'Datum von: %s' + #13#10 + ' bis: %s'; Anzeige := Format(SDatum, [DateToStr(von), DateToStr(bis)]); lbPrjDatumAlt.Caption := SDatumVon0101 + IntToStr(jahr) + #13#10 + ' ' + SDatumBis3112 + IntToStr(jahr); lbPrjDatumNeu.Caption := Anzeige; end; Nochmals eine Frage, ich kann meine Konstanten SDatumVon0101 uns SDatumBis3112 nicht in ein anderes Format umwandeln, da es Konstanten sind und immer einen festen Wert besitzen, der nicht veränderbar ist? Richtig verstanden? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:30 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz