3.1 C
London
Friday, December 20, 2024
HomeSoftware TutorialsGoogle SheetsGoogle Sheets: How to Convert Dates to Strings

Google Sheets: How to Convert Dates to Strings

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

You can use the following formulas to convert a date to a string in Google Sheets:

Method 1: Convert Date to String 

=TEXT(A1, "mm-dd-yyyy")

Method 2: Convert Datetime to String

=TEXT(A1,"yyyy-mm-dd hh:mm:ss")

The following examples show how to use these formulas in practice.

Example 1: Convert Date to String in Google Sheets

Suppose we have the following list of dates in Google Sheets:

We can use the following formula to convert the date in cell A1 to a string:

=TEXT(A1, "mm-dd-yyyy")

We can then copy and paste this formula down to the remaining cells in column B:

All of the cells in column B are now a string.

To verify this, we can type =ISTEXT(A2) and =ISTEXT(B2) to check if the values in cells A2 and B2 are strings, respectively:

We can see that the value in cell A2 is not a string since the ISTEXT() function returned FALSE.

Conversely, we can see that the value in cell B2 is a string since the ISTEXT() function returned TRUE.

Example 2: Convert Datetime to String in Google Sheets

Suppose we have the following list of datetimes in Google Sheets:

We can use the following formula to convert the datetime in cell A1 to a string:

=TEXT(A1,"yyyy-mm-dd hh:mm:ss")

We can then copy and paste this formula down to the remaining cells in column B:

All of the cells in column B are now a string.

To verify this, we can type =ISTEXT(A2) and =ISTEXT(B2) to check if the values in cells A2 and B2 are strings, respectively:

We can see that the value in cell A2 is not a string since the ISTEXT() function returned FALSE.

Conversely, we can see that the value in cell B2 is a string since the ISTEXT() function returned TRUE.

Additional Resources

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

How to Extract Substring in Google Sheets
How to Filter by Date Range in Google Sheets
How to AutoFill Dates in Google Sheets

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories