Autor Beitrag
seven-ex
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Mi 10.01.07 13:46 
Hallo,

wie kann ich von einem Datum herausfinden was das Quartals Anfang Datum ist und das Ende?

Gruß
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Mi 10.01.07 14:55 
Hi!

Berechnen! Du musst doch nur gucken, in welchem Monat du dich mit deinem Datum befindest. Jeweils jeder dritte Monat ist dann ein neuer Quartalsbeginn. Einfach mit Suche in der Entwickler-Ecke DIV arbeiten. Ist, glaube ich, nichts schweres. :)

Quartal := (DeinMonat div 3) + 1;

Gruß
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.01.07 14:56 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  YourDate: TDateTime;
  Month, Dummy: Word;
begin
  YourDate := StrToDate(Edit1.Text);
  DecodeDate(YourDate, Dummy, Month, Dummy);
  ShowMessage('Quartal: ' + IntToStr((Month + 2div 3));
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.01.07 15:00 
user profile iconfreedy hat folgendes geschrieben:
Einfach mit Suche in der Entwickler-Ecke DIV arbeiten. Ist, glaube ich, nichts schweres. :)

Anscheinend doch ;-)
user profile iconfreedy hat folgendes geschrieben:
Quartal := (DeinMonat div 3) + 1;

Das ist nämlich falsch...
01.01.2006: Ergebnis 1
01.02.2006: Ergebnis 1
01.03.2006: Ergebnis 2
Du musst den Monat Januar als 0 nehmen, wenn du div 3 benutzt. Oder wie ich als 3, damit direkt das Quartal rauskommt... ;-)
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Mi 10.01.07 15:13 
Japp, stimmt... war so ins Blaue geschrieben. Wie eigentlich immer. Oder probierst du alles, was du postest nochmal durch? :wink:
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 10.01.07 15:15 
Nö, tue ich auch nicht... Was ich eben geschrieben habe, hab ich ja auch nicht getestet. Aber ich bin mir sicher dass es geht ;-).

Da div ja sehr einfach ist, sehe ich auch sofort was rauskommt. Oder eben was nicht rauskommt. :mrgreen:
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Mi 10.01.07 15:19 
Aber wenigstens stehe ich dazu, auch mal Fehler zu machen. ;-)
seven-ex Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Do 11.01.07 15:16 
Joooo,

das ist das was ich wollte :)
aber wie bestimme ich das ende Datum?

Wie weiß ich ob es der 31te ist und wann der 30te? (Ende Q.)
:?:
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 11.01.07 15:24 
Wie wärs mit AnfangDesNaechstenQuartals - 1?

_________________
Anonymes Eckenkind
OldGrumpy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 82



BeitragVerfasst: Do 11.01.07 15:39 
user profile iconseven-ex hat folgendes geschrieben:
Joooo,

das ist das was ich wollte :)
aber wie bestimme ich das ende Datum?

Wie weiß ich ob es der 31te ist und wann der 30te? (Ende Q.)
:?:


Also *das* muss man doch wirklich nicht berechnen, solange nicht irgendein Papst einen neuen Kalender beschließt :mrgreen:
seven-ex Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Do 11.01.07 16:20 
ich habe es gerade bemerkt :oops: