Autor Beitrag
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 13.07.02 16:13 
Hallo !!!

Wie kann ich mir das aktuelle Datum in einen String holen aber ohne die Jahreszahl ?? Also z.B. wenn ich an einem Geburtstag jedes Jahr eine Meldung ausgeben möchte.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Sa 13.07.02 16:34 
Lad dir das Datum in einen String und dann mit Copy(deineDatumString,1,BisZumletztenPunkt)
Schau dir einfach mal Copy() an

_________________
Keine Signatur ...
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 13.07.02 16:37 
kannst du mir nicht mal ebend den code geben ?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Sa 13.07.02 16:39 
Wenn du nicht lesen kannst, gebe ich dir den Code.

Ansonsten gehört ein Copy()-Befehl echt zu den Grundlagen, die dir immer wieder nützen werden...... :wink:

_________________
Keine Signatur ...
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Sa 13.07.02 17:30 


Zuletzt bearbeitet von Pit am Sa 05.10.02 07:22, insgesamt 1-mal bearbeitet
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Sa 13.07.02 17:45 


Zuletzt bearbeitet von Pit am Sa 05.10.02 07:22, insgesamt 1-mal bearbeitet
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Sa 13.07.02 17:50 


Zuletzt bearbeitet von Pit am Sa 05.10.02 07:22, insgesamt 2-mal bearbeitet
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Sa 13.07.02 17:50 
Hi,
wenn ich die Frage richtig verstehe sollte doch ein einfaches
ausblenden Quelltext
1:
FormatDateTime('dd. mm.', date);					

ausreichen.
Oder habe ich was falsch verstanden?

Vorziehen wüde ich aber die Arbeit mit Zahlen und somit eine verwendung von EncodeDate und DecodeDate.

Gruß
Klabautermann
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Sa 13.07.02 18:35 
@PIT
Bist du heute mit dem falschen Fuss aufgestanden?
DateToStr() muss ich dir glaube nicht erklären?

Wenn er das Datum sucht, so z.B. in einer DB, wird er es so nicht finden.

_________________
Keine Signatur ...
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Sa 13.07.02 18:58 


Zuletzt bearbeitet von Pit am Sa 05.10.02 07:23, insgesamt 1-mal bearbeitet
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Sa 13.07.02 19:36 
Mein Hinweis mit dem falschen Fuss bezieht sich lediglich auf deine Hinweise zu "friemelei ... VB... und Delphi vernüftig"

Ob du es jetzt so oder so löst, ist letzten Endes unerheblich.
Mit dem Schaltjahr bist du auch wieder am "Friemeln". Must halt in einem Nichtschaltjahr anstatt dem 29.02. den 01.03. draus machen.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Procedure ShowByDecode;
var d,m,y : word;
begin
DecodeDate(Now,y,m,d);
ShowMessage(IntToStr(d)+'.'+IntToStr(m)+'.');
end;

Procedure ShowByDate;
begin
ShowMessage(Copy(DateToStr(now),1,LastDelimiter('.',DateToStr(Now))));
end;


Für eine Abfrage muss er eh das aktuelle Jahr dazu packen. So wie ich es verstanden habe, will er nachschauen, wer heute, am 13.07. + aktuelles Jahr Geburtstag hat. Und wenn er den String auf ein yyyymmdd umstricken muss, geht das auch nur über "Friemelei".
In diesem Sinne :)

_________________
Keine Signatur ...
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Sa 13.07.02 20:19