# Counting the number of days in a month by combining the DAY and EOMONTH functions (spreadsheet)

To count the days of a month using a combination of functions `DAY`in Google Sheets , follow these steps:`EOMONTH`table of contents

## Using the EOMONTH function

Using the EOMONTH function : `EOMONTH`The function returns the date of the last day of a particular month.

This function takes as arguments a specific date (e.g. “2024-02-01”) and a number to add or subtract the month (0 is the month, 1 is the next month, -1 is the previous month).

For example, `=EOMONTH("2024-02-01", 0)`returns the last day of February 2024, the date from which to calculate the number of days in February 2024.

``=EOMONTH("2024-02-01", 0)``

## Using the DAY function

Using the DAY function : `DAY`The function returns the “day” part of a date as a number. By inputting the output from the function into this function `EOMONTH`, you can get the number of days in the month.

For example, `=DAY(EOMONTH("2024-02-01", 0))`returns the number of days in February 2024, or 29 (in a leap year).

``=DAY(EOMONTH("2024-02-01", 0))``

Therefore, if you want to find the number of days in any month, `EOMONTH`enter the first day of the month (e.g. “2024-02-01”) into the function and `DAY`use the function to get the day of the last day of the month.

This will calculate the number of days in the month.

## A concrete example of calculating the number of days

Let me give you a concrete example of calculating the number of days in March 2024.

``=DAY(EOMONTH("2024-03-01", 0))``
In this formula, `EOMONTH`the function calculates the last day of the month starting from March 1, 2024. The function then `DAY`returns the “day” part of that last day as a number.
This method can be used for any year and month. For example, if you want to know the number of days in July 2025, `=DAY(EOMONTH("2025-07-01", 0))`enter the formula as In this way, you can easily calculate the number of days in different months and years.