minute - Minute component of input date and time - MATLAB (original) (raw)

Main Content

Minute component of input date and time

Syntax

Description

m = minute([t](#mw%5F8179b8ad-302e-4ad6-bbdf-1ff84f6817cc)) returns the minute component for each date and time specified in t.

The m output is a double array and contains integer values from 0 to 59. To assign minute values to the minute component of values in t, use t.Minute and modify the Minute property.

example

Examples

collapse all

t1 = datetime('now'); t = t1 + minutes(2:4)

t = 1×3 datetime 01-Feb-2025 09:12:24 01-Feb-2025 09:13:24 01-Feb-2025 09:14:24

Input Arguments

collapse all

Input date and time, specified as a datetime array.

To support existing code that previously required Financial Toolbox™, minute also accepts serial date numbers and text as inputs, but they are not recommended. For more information, seeVersion History.

Extended Capabilities

expand all

Theminute function fully supports tall arrays. For more information, see Tall Arrays.

Usage notes and limitations:

Version History

Introduced in R2014b

expand all

Although minute supports serial date number and text inputs,datetime values are recommended instead. Thedatetime data type provides flexible date and time formats, storage out to nanosecond precision, and properties to account for time zones and daylight saving time.

To convert serial date numbers or text to datetime values, use the datetime function. For example:

t = datetime(738427.656845093,"ConvertFrom","datenum"); m = minute(t)

There are no plans to remove support for serial date number or text inputs.

In previous releases, there were two minute functions: one in MATLAB® that accepted datetime values, and one in Financial Toolbox that accepted serial date numbers or text values. As of R2022a, you can call minute without Financial Toolbox. When you call minute from MATLAB, it accepts all previous input types.

For example, you can make these calls with a serial date number and text from MATLAB:

m = minute(738427.656845093)

m = minute("2021/09/28 15:45:51.4160")

In addition, minute accepts a second input for the date format when the first input is not a datetime array:

In this syntax, specify F using a valid date format as documented for the datestr function, though'Q' format specifiers are not supported. For example:

m = minute("2021/09/28 15:45:51.4160","yyyy/dd/mm hh:MM:ss.fff")