Re: finding the day of the year
- From: "Bruce Roberts" <ber@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jul 2005 14:05:49 -0400
"anthony" <mrmclarge@xxxxxxxxxxx> wrote in message
news:UVNFe.3942$PL5.367940@xxxxxxxxxxxxxxxxxx
> Doews anyone know how I can find the day of the year. If I select a date
> with datepicker how can I then set about finding what number day of the
> year it is
>
> eg: 1/1/2005 would be day 1
> eg: 12/31/whatever year would be day 365 or 366 depending if it is a
> leap year.
Subtract the date of the first day of the year from the date and add one.
function DayOfYear (aDate : tDateTime) : integer;
var yr, mth, day : word;
begin
DecodeDate (aDate, yr, mth, day);
result := (aDate - EncodeDate (yr, 1, 1)) + 1;
end;
.
- Follow-Ups:
- Re: finding the day of the year
- From: Bruce Roberts
- Re: finding the day of the year
- References:
- finding the day of the year
- From: anthony
- finding the day of the year
- Prev by Date: Re: finding the day of the year
- Next by Date: Disable TListBox Redraw...
- Previous by thread: Re: finding the day of the year
- Next by thread: Re: finding the day of the year
- Index(es):
Relevant Pages
|