This function calculates
the day number of the quarter in which a timestamp falls.
Syntax:
DayNumberOfQuarter(timestamp[,start_month])
Return data type: integer
The
function always uses years based on 366 days.
Arguments:
Arguments
Argument
Description
timestamp
The date to evaluate.
start_month
By
specifying a start_month between
2 and 12 (1, if omitted), the beginning of the year may be moved forward
to the first day of any month. For example, if you want to work with a fiscal
year starting March 1, specify start_month
= 3.
These examples use the date format DD/MM/YYYY. The date format is specified in the SET DateFormat statement at the top of your data load script. Change the format in the examples to suit your requirements.
Scripting examples
Example
Result
DayNumberOfQuarter('12/09/2014')
Returns 74, the day number of the current quarter.
DayNumberOfQuarter('12/09/2014',3)
Returns 12, the day number of the current quarter. In this case, the first quarter starts with March (because start_month is specified as 3). This means that the current quarter is the third quarter, which started on September 1.
Example:
Add the example script to your app and run it. Then add, at least, the fields listed in the results column to a sheet in your app to see the result.
ProjectTable:
LOAD recno() as InvID, * INLINE [
StartDate
28/03/2014
10/12/2014
5/2/2015
31/3/2015
19/5/2015
15/9/2015
] ;
NrDays:
Load *,
DayNumberOfQuarter(StartDate,4) As DayNrQtr
Resident ProjectTable;
Drop table ProjectTable;
The resulting table shows the returned values of DayNumberOfQuarter for each of the records in the table.