Autor Beitrag
Ace
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

WinXP
Delphi 7 Pers. / Turbo Delphi.NET
BeitragVerfasst: Di 11.05.04 14:42 
Wie das Topic ja schon sagt möchte ich gerne den laufenden Tag im Jahr herausfinden.
Z.B ist der 1. Februar der 32 Tag im Jahr. Kennt jemand eine fertige Funktion dafür oder hat jemand einen Ansatz wie man das lösen könnte?
Bin selber grad am grübeln...
Aton
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 125

Windows XP
D7 Enterprise
BeitragVerfasst: Di 11.05.04 14:57 
Hallo du,

ich habe mir eben mal so gedacht, wie würdest du so eine Funktion nennen:
Hmm, DayOfTheYear.

Und dann habe ich in der Delphi Hilfe nachgeschaut, und siehe da, es gibt so eine Funktion. :wink:
(zu mindest in D7)

Gruß Jens.
Ace Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

WinXP
Delphi 7 Pers. / Turbo Delphi.NET
BeitragVerfasst: Di 11.05.04 15:00 
Tja, das habe ich auch gemacht. Ich benutze aber Delphi 5 und die Funktion gibt's erst ab Version 6
:|
Ace Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

WinXP
Delphi 7 Pers. / Turbo Delphi.NET
BeitragVerfasst: Di 11.05.04 15:13 
Habs mir jetzt einfach aus dem Code von Delphi 7 selber zusammengebaut.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
function DayOfTheYear(const AValue: TDateTime): Word;
var
  LYear, LMonth, LDay: Word;
begin
  DecodeDate(AValue, LYear, LMonth, LDay);
  Result := Trunc(AValue - EncodeDate(LYear, 1, 1)) + 1;
end;
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Di 11.05.04 15:17 
Hallo,

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
function TagDesJahres(const aDatum:TDateTime):Integer;
var t, m, j:Word;
begin
  DecodeDate(aDatum, j, m, t);
  Result:=Trunc(aDatum-EncodeDate(j, 1, 1))+1;
end; // _Anzahltage

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)