QUARTER scalar function
The QUARTER function returns an integer in the range 1–4 that represents the quarter of the year in which the date resides. For example, any dates in January, February, or March return the integer 1.
The schema is SYSIBM.
The argument must be an expression that returns one of the following built-in data types: a date, a timestamp, a character string, or a graphic string. If expression is a character or graphic string data type, it must not be a CLOB or DBCLOB, and its value must be a valid string representation of a date or timestamp with an actual length of not greater than 255 bytes. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.
If expression is a timestamp with a time zone, or a valid string representation of a timestamp with a time zone, the result is determined from the UTC representation of the datetime value.
The result of the function is a large integer.
The result can be null; if the argument is null, the result is the null value.
SELECT QUARTER('2008-08-25')
FROM SYSIBM.SYSDUMMY1
SELECT QUARTER(ACENDATE)
INTO :QUART
FROM DSN8C10.PROJ
WHERE PROJNO = 'AD3111' AND ACTNO = 70;
QUART is
set to 4.SELECT QUARTER('2003-01-02-20.10.05.123456'),
QUARTER('2003-01-02-12.10.05.123456-08:00'),
QUARTER('2003-01-03-05.10.05.123456+09:00')
FROM SYSIBM.SYSDUMMY1;
For each invocation of the QUARTER
function in this SELECT statement, the result is 1.When the input argument contains a time zone, the result is determined from the UTC representation of the input value. The string representations of a timestamp with a time zone in the SELECT statement all have the same UTC representation: 2003-01-02-20.10.05.123456. The month portion of the UTC representation is 1 for January, which is in the first quarter.