Date Quarter

Submitted by:Jhon Smith

Date added:23 January, 2013

Category:Delphi

Returns the number of the quarter containing a given date.

Tags: date quarter

Code Snippet:

function DateQuarter(const D: TDateTime): Byte;
var
Year, Month, Day: Word; // year, month and date components of D
begin
SysUtils.DecodeDate(D, Year, Month, Day);
Result := 4 - ((12 - Month) div 3);
end;
 
 

Comments