DelphiBasics
DayOfTheYear
Function
Gives the day of the year for a TDateTime value (ISO 8601) DateUtils unit
 function DayOfTheYear(const Date TDateTime):Word;
Description
The DayOfTheYear function returns an index number for the day of the year.
 
Depending on the year, the value is in the range 1..366
Related commands
DayOfTheMonthGives day of month index for a TDateTime value (ISO 8601)
DayOfTheWeekGives day of week index for a TDateTime value (ISO 8601)
DayOfWeekGives day of week index for a TDateTime value
MonthOfTheYearGives the month of the year for a TDateTime value
 Download this web site as a Windows program.




 
Example code : Show the day of the year for a TDateTime variable
var
  myDate : TDateTime;

begin
  myDate := EncodeDate(2002, 10, 29);
  ShowMessage('20/10/2002 day of year  = '+
              IntToStr(DayOfTheYear(myDate)));
end;
Show full unit code
  20/10/2002 day of the year = 302
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page