How can I convert a date into YYYYMMDD format in Google Sheets?

To convert a date into YYYYMMDD format in Google Sheets, follow these steps:
1. Select the cell or cells containing the dates that you want to convert.
2. Right-click and select “Format cells”.
3. In the “Number” tab, select “Custom” from the “Category” list.
4. In the “Format code” field, enter “YYYYMMDD”.
5. Click “Apply” and then “OK”.
Your dates will now be displayed in the YYYYMMDD format. This format is useful for organizing and sorting dates in a chronological order.

Google Sheets: Convert Date to YYYYMMDD Format


You can use the following formula to convert a date to a YYYYMMDD format in Google Sheets:

=TEXT(A1, "YYYYMMDD")

This will convert a date such as 1/4/2023 to a format of 20230104.

You can also use the following formula to insert dashes between the year, month and day:

=TEXT(A1, "YYYY-MM-DD") 

This will convert a date such as 1/4/2023 to a format of 2023-01-04.

Note that each formula assumes the date is in cell A1.

The following example shows how to use each formula in practice.

Example: Convert Date to YYYYMMDD Format in Google Sheets

We can use the following formula to convert a date to a YYYYMMDD format in Google Sheets:

=TEXT(A2, "YYYYMMDD")

We can type this formula into cell B2 and drag the formula down to every remaining cell in column B:

Google Sheets convert date to YYYYMMDD format

Column B displays each date in column A in a YYYYMMDD format.

For example:

  • 1/4/2023 has been converted to 20230104.
  • 1/6/2023 has been converted to 20230106.
  • 2/3/2023 has been converted to 20230203.

And so on.

=TEXT(A2, "YYYY-MM-DD") 

We can type this formula into cell B2 and drag the formula down to every remaining cell in column B:

Column B displays each date in column A in a YYYY-MM-DD format.

For example:

  • 1/4/2023 has been converted to 2023-01-04.
  • 1/6/2023 has been converted to 2023-01-06.
  • 2/3/2023 has been converted to 2023-02-03.

And so on.

Note: You can find the complete documentation for the Google Sheets TEXT function .

Additional Resources

The following tutorials explain how to perform other common tasks in Google Sheets:

x