Tri dans une DBGrid sur un champ date au format jj/mm
Bonjour à tous,
J'ai un petit problème pour trier des date sous le format jj/mm.
Mon application sort tous les anniversaires entre le 1er du mois et un jour sélectionner dans le mois, il est biensûr possible que plusieurs personnes soient né le même jour, cependant à l'affichage, j'ai par exemple ceci:
BIRTHDAY
-------------
1/10
1/10
1/10
...
10/10
10/10
11/10
12/10
12/10
...
19/10
19/10
puis ça recommence à
2/10
2/10
...
20/10
29/10
puis ça recommence à
3/10
4/10
5/10
...
9/10
et ainsi de suite.
J'aimerai que toutes les dates ce suivent
1/10
1/10
2/10
2/10
2/10
3/10
...
19/10
20/10
21/10
...
29/10
etc...
Voici mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
procedure SetBirthdayBeforeADateInt;
const
aBIRTHDAY : integer = 0;
var
sMonthOfYearNow : string;
sDayOfMonthNow : string;
sBirthday : string;
begin
ShortDateFormat := 'mm';
sMonthOfYearNow := DateToStr(Now);
ShortDateFormat := 'dd/mm/yyyy';
sDayOfMonthNow := '01';
try
with DataModule1 do
begin
IBQueryIntContact.Close;
IBQueryIntContact.SQL.Clear;
IBQueryIntContact.SQL.Add('SELECT NUM, NOM, PRENOM, BDA, TEL, TEL2,');
IBQueryIntContact.SQL.Add('CANDIDAT, PRO, DISP, DAT, SEL,');
IBQueryIntContact.SQL.Add('EXTRACT(day from BDA) || ''/'' ||');
IBQueryIntContact.SQL.Add('EXTRACT(month from BDA) AS BIRTHDAY');
IBQueryIntContact.SQL.Add('FROM INT');
IBQueryIntContact.SQL.Add('where extract(month from BDA) * 100 + extract(day from BDA) >= '); //101');
IBQueryIntContact.SQL.Add(QuotedStr(sMonthOfYearNow + sDayOfMonthNow));
IBQueryIntContact.SQL.Add('and extract(month from BDA) * 100 + extract(day from BDA) <= '); //201');
sBirthday := DateToStr(frmListeInt.DateTPAnnifInterim.Date);
IBQueryIntContact.SQL.Add(QuotedStr(GetConvertDate(sBirthday, aBIRTHDAY)));
IBQueryIntContact.SQL.Add('ORDER BY 12'); // 12 est la colonne BIRTHDAY
IBQueryIntContact.Open;
//IBQueryIntContact.Last;
end;
end;
ShortDateFormat := 'dd/mm/yyyy';
end; |
Quelqu'un aurait il une solution à me proposer
Merci d'avance
Jeankiki