fq - Fiscal Quarter

Prev Next

Function Names

fq

Description

This function identifies the financial (or fiscal) quarter of the date provided. Example: fq( "2022-02-01", 3 ) returns 4 because February lies in the 4th quarter in the fiascal year ending in March. If a blank date is provided, then 0 is returned.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2

Parameters

No.TypeDescription
1
input
date or string converted to date Date

Value to extract as described above

2
input
numeral Month year ending

Specify the last month of the financial year (Example: Specify 3 for fiscal years ending on 31. March every year). Value must be between 1 and 12.

Return value

TypeDescription
numeral
string
Result

Quarter (1..4)

Examples

  date[] = "2022-05-01";
  echo( "Date is ", date[] );

  for (month[]=1, month[]<=12, month[]++ )
      echo( "Year ending in ", str( date(2022,month[],1),"Mmmm" ), ": ", fq( date[], month[] ) );

Output

Date is 2022-05-01
Year ending in January: 2
Year ending in February: 1
Year ending in March: 1
Year ending in April: 1
Year ending in May: 4
Year ending in June: 4
Year ending in July: 4
Year ending in August: 3
Year ending in September: 3
Year ending in October: 3
Year ending in November: 2
Year ending in December: 2
Try it yourself: Open LIB_Function_fq.b4p in B4P_Examples.zip. Decompress before use.

See also

quarter
fy