MINUTE

The MINUTE function returns the minute part of a value.

Read syntax diagram
>>-MINUTE(expression)------------------------------------------><

The schema is SYSIBM.

The argument must be an expression that returns a value of one of the following built-in data types: a time, a timestamp, a character string, a graphic string, or a numeric data type.

  • If expression is a character or graphic string, it must not be a CLOB or DBCLOB, and its value must be a valid string representation of a time or timestamp with an actual length of not greater than 255 bytes. For the valid formats of string representations of times and timestamps, see String representations of datetime values.
  • If expression is a number, it must be a time or timestamp duration. For the valid formats of time and timestamp durations, see Datetime operands.

Start of changeIf 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.End of change

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.

The other rules depend on the data type of the argument:

  • If the argument is a time, timestamp, or string representation of either, the result is the minute part of the value, which is an integer between 0 and 59.
  • If the argument is a time duration or timestamp duration, the result is the minute part of the value, which is an integer between -99 and 99. A nonzero result has the same sign as the argument.
  • Start of changeIf the argument contains a time zone, the result is the year part of the value expressed in UTC.End of change
Example 1: Assume that a table named CLASSES contains one row for each scheduled class. Assume also that the class starting times are in the TIME column named STARTTM. Using these assumptions, select those rows in CLASSES that represent classes that start on the hour.
   SELECT * FROM CLASSES
     WHERE MINUTE(STARTTM) = 0;
Start of changeExample 2: The following invocations of the MINUTE function returns the same result:
SELECT MINUTE('2003-01-02-20.10.05.123456'), 
			MINUTE('2003-01-02-12.10.05.123456-08:00'), 
			MINUTE('2003-01-03-05.10.05.123456+09:00') 
		FROM SYSIBM.SYSDUMMY1;
For each invocation of the MINUTE function in this SELECT statement, the result is 2.End of change

Start of changeWhen 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 minute portion of the UTC representation is 10.End of change