minute

Minute component of a datetime.

Category: Language Fundamentals > Data Types

Syntax

m = minute(t)

Returns the minute, from 0 to 59, of each element of t.

Description

Only the minute within the hour is returned, not a total: 14:45:30 gives 45. The companions hour and second extract the other time-of-day fields. For total elapsed time use durations, as in minutes(d).

Input arguments

t
datetime array.

Output arguments

m
Double array of the same size as t.

Example

Minute of the hour

t = datetime(2024,3,5,14,45,30);
minute(t)
minute([t, t + minutes(20)])
Output
ans = 45
ans = 1×2

    45     5

See also

hour second minutes datetime