ymd
Year, month, and day numbers of datetime
Syntax
Description
Examples
Find Year, Month, and Day Numbers of Dates
t = datetime(2013,05,31):calmonths(3):datetime(2014,06,15)
t = 1x5 datetime
31-May-2013 31-Aug-2013 30-Nov-2013 28-Feb-2014 31-May-2014
[y,m,d] = ymd(t)
y = 1×5
2013 2013 2013 2014 2014
m = 1×5
5 8 11 2 5
d = 1×5
31 31 30 28 31
ymd
returns the year, month, and day values in separate arrays.
Input Arguments
t
— Input date and time
datetime
array
Input date and time, specified as a datetime
array.
Output Arguments
y
— ISO year numbers
scalar | vector | matrix | multidimensional array
ISO year numbers, returned as a scalar, vector, matrix, or
multidimensional array of integer values. ISO year numbers include a year
zero and represent years BCE using negative values. y
is
of type double
and is the same size as
t
.
m
— Month numbers
scalar | vector | matrix | multidimensional array
Month numbers, returned as a scalar, vector, matrix, or multidimensional
array of integer values from 1 to 12. m
is of type
double
and is the same size as
t
.
d
— Day of month numbers
scalar | vector | matrix | multidimensional array
Day of month numbers, returned as a scalar, vector, matrix, or
multidimensional array of integer values from 1 to 28, 29, 30, or 31,
depending on the month and year. d
is of type
double
and is the same size as
t
.
Extended Capabilities
Tall Arrays
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™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Distributed Arrays
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 History
Introduced in R2014b
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)