Minute component of input date and time
Find Minute Number of Datetime Values
t1 = datetime('now'); t = t1 + minutes(2:4)
t = 1x3 datetime 31-Aug-2022 03:40:45 31-Aug-2022 03:41:45 31-Aug-2022 03:42:45
m = minute(t)
m = 1×3 40 41 42
t — Input date and time
Input date and time, specified as a
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, see
Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For more information, see Tall Arrays.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
In generated code, this function supports only
datetimearrays as inputs. You cannot specify serial date numbers or text as inputs in generated code.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version HistoryIntroduced in R2014b
R2022a: Serial date number and text inputs not recommended
minute supports serial date number and text inputs,
datetime values are recommended instead. The
datetime 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
datetime function. For
t = datetime(738427.656845093,"ConvertFrom","datenum"); m = minute(t)
m = 45
There are no plans to remove support for serial date number or text inputs.
minute functions from Financial Toolbox and MATLAB combined
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
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 = 45
m = minute("2021/09/28 15:45:51.4160")
m = 45
minute accepts a second input for the date
format when the first input is not a
m = minute(t,F)
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")
m = 45