Skip to Main Content Skip to Search
Product Documentation

eomday - Last day of month

Syntax

E = eomday(Y, M)

Description

E = eomday(Y, M) returns the last day of the year and month given by corresponding elements of arrays Y and M.

Examples

Show the end of month for January through September for the year 1900:

eomday(1900, 1:9)
ans =
    31    28    31    30    31    30    31    31    30

Find the number of days during that period:

sum(eomday(1900, 1:9))
ans =
   273

Because 1996 is a leap year, the statement eomday(1996,2) returns 29. To show all the leap years in the twentieth century, try:

y = 1900:1999;
E = eomday(y, 2);
y(find(E == 29))

ans =
  Columns 1 through 6
     1904     1908     1912     1916     1920     1924

  Columns 7 through 12 
     1928     1932     1936     1940     1944     1948

  Columns 13 through 18 
     1952     1956     1960     1964     1968     1972

  Columns 19 through 24 
     1976     1980     1984     1988     1992     1996     

See Also

datenum | datevec | weekday

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS