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




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

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