Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# eomday

Last day of month

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

Was this topic helpful?