How to: |
Given a date in standard date or date-time format and a component, DTPART returns the component value in integer format.
DTPART(date, component)
where:
Date or date-time
Is the full-component date in standard date or date-time format.
Keyword
Is the component to extract in integer format. Valid components (and values) are:
The following request against the WF_RETAIL data source extracts the QUARTER component from the employee start date:
DEFINE FILE WF_RETAIL QTR/I2 = DTPART(START_DATE, QUARTER); END TABLE FILE WF_RETAIL PRINT START_DATE QTR AS Quarter BY EMPLOYEE_NUMBER WHERE EMPLOYEE_NUMBER CONTAINS 'AH' ON TABLE SET PAGE NOPAGE END
The output is: