Dates are an inevitable part of Google Sheets. And like many other concepts of spreadsheets, they require a bit of learning.
In this tutorial, you will find out how Google stores dates and how you can format them for your better convenience. Some date formats are offered to you by spreadsheets while others should be created from scratch. There are even a couple of handy functions for the task.
I also describe a couple of ways to convert your dates to numbers and text if necessary.
How Google Sheets formats dates
First things first: before any activities related to dates in spreadsheets, it's crucial to understand the core principles of how dates work.
For its internal database, Google Sheets stores all dates as integer numbers. Not sequences of a day, month, and year as we got used to seeing, but simple integers:
- 1 for December 31, 1899
- 2 for January 1, 1900
- 102 for April 11, 1900 (100 days after January 1, 1900)
- and so on.
Unlike Excel that cannot store dates as negative numbers, in Google, for dates prior to December 31, 1899, the numbers will be negative:
- -1 for December 29, 1899
- -2 for December 28, 1899
- -102 for September 19, 1899
Regardless of how Google Sheets formats dates for you to see in cells, spreadsheets always store them as integers. It's an automatic Google Sheets date format that helps to treat dates correctly.
Tip. The same goes for time units – they are merely decimals for your table:
- .00 for 12:00 AM
- .50 for 12:00 PM
- .125 for 3:00 AM
- .573 for 1:45 PM
A date paired with time is kept as an integer with decimal places:
- 31,528.058 is April 26, 1986, 1:23 AM
- 43,679.813 is August 2, 2019, 7:30 PM
Change date format in Google Sheets to another locale
Another important thing to keep in mind is your spreadsheet locale.
The locale is what presets your Google Sheets date format based on your region. Thus, if you're currently in the US, 06-Aug-2019 will be put as 8/6/2019 in your sheet, while for the UK it'll be 6/8/2019.
To ensure the correct calculations, it's vital to have the correct locale set, especially if the file was created in another country:
- Go to File > Settings in the Google Sheets menu.
- Find Locale under the General tab and pick the desired location from the drop-down list:
Tip. As a bonus, you can also specify your time zone here to record your file history in it.
Note. The locale doesn't change the language of your Sheets. However, the date formatting will be applied to the entire spreadsheet. Everyone who works with it will see the changes, no matter their place on the globe.
How to change date format in Google Sheets
If dates in your tables are formatted inconsistently or all you can see is strange sets of numbers instead, don't panic. You simply need to change the date format in your Google Sheets using built-in instruments.
Default Google Sheets date format
- Select all cells you'd like to format.
- Go to Format > Number in the spreadsheet menu and pick Date to see the date only or Date time to get both date and time in a cell:
The integers successfully turn into the format that you'll recognize at a glance. These are default Google Sheets date formats:
Tip. You can find the same formats if you click on the 123 icon on the spreadsheet toolbar:
Custom date formats
If you don't like how Google Sheets formats dates by default, I won't blame you. Luckily, there's plenty of room to improvise thanks to custom date formats.
You can access them from the same Google Sheets menu: Format > Number > Custom date and time:
You will see the window with lots of different custom date formats available. Whichever one you chose and apply, your dates will look the same:
If you're still unhappy with the appearance of your dates, you can tailor your own custom date format:
- Select the cells you want to format.
- Go to Format > Number > Custom date and time.
- Place the cursor into the field at the top that contains the date units and delete everything with your Backspace or Delete keys:
- Click the arrow to the right of the field and pick the unit you'd like to have first. Don't forget to type the separator afterwards.
Repeat till all the necessary units are added (no worries, you'll be able to add or remove them later):
- Notice that each unit has double arrows to its right. Click them and you'll be able to adjust the exact way to display the value.
Here's what I can choose for Day:
This way, you can edit all values, insert additional and delete obsolete ones. You are free to separate the units with various characters including commas, slashes, and dashes.
- Once you're ready, click Apply.
Here's what format I've created and how my dates look now:
QUERY function for Google Sheets to format dates
There's one more way to change date format in Google Sheets – with a formula, of course. Since this is not the first time of me showing QUERY to you, I'm starting to think of it as a real cure-all for spreadsheets. :)
I have an example table where I track the shipment of a few orders:
I want to change the date format in column B. Here's my QUERY formula:
=QUERY(A1:C7,"select * format B 'd-mmm-yy (ddd)'")
- first, I specify the range of my entire table – A1:C7
- then I'm asking the formula to return all columns – select *
- and at the same time re-format column B the way I put into the formula – format B 'd-mmm-yy (ddd)'
The formula works like a charm. It returns my entire table and changes date format in column B:
As you may have noticed, to change the date format via the formula, I used special codes that represent different looks of days, months, and years. If you're not familiar with them, here's a list of these codes for dates:
|Day without a leading zero for 1-9
|Day with a leading zero for 1-9
|Day as an abbreviation
|Day as a full name
(if not preceded or followed by
hours or seconds)
|Month without a leading zero
(if not preceded or followed by
hours or seconds)
|Month with a leading zero
|Month as an abbreviation
|Month as a full name
|First letter of the month
|Two digit year
|Full numeric year
Tip. If you'd like to supply your date format with time as well, you need to add codes for time units. You will find the full list of time codes in this guide.
Using these codes, you can format the dates in so many ways:
- Get the hold of the year, month, or day only:
=QUERY(A1:C7,"select * format B 'yyyy'")
- Return the day, month, and the day of the week:
=QUERY(A1:C7,"select * format B 'dd mmmm, dddd'")
By the way, what date format have you got used to? :)
Google Sheets: convert date to number
In case you need to see numbers instead of dates, one of the methods below will be useful.
Convert date to number by changing the format
- Select those cells with dates that you want to convert to numbers.
- Go to Format > Number and this time pick Number among other options.
- Voila – all selected dates have turned into numbers that represent them:
DATEVALUE function for Google Sheets
Another way for Google Sheets to convert date to number is by using the DATEVALUE function:
where date_string represents any date in the known for spreadsheets format. The date should be put in double-quotes.
For example, I want to convert August 10, 2023 to a number. All the formulas below will return the same result: 45148.
=DATEVALUE("August 10, 2023")
Tip. If you're not sure whether Google Sheets understands the format you're about to enter, try typing the date into another cell first. If the date is recognized, it'll be aligned to the right.
You can also fill your cells with dates in one column, and then reference them in your formulas in another column:
Google Sheets: convert date to text
Converting dates to text in spreadsheets is the task for the TEXT function:
- number – regardless of what number, date, or time you give to the function, it will return it as text.
- format – the text will be formatted the way you specify in the formula.
Tip. To set the format correctly, use the same codes as you did for the QUERY function.
The real-data formula may look like this:
Here's how I converted my date – 2/7/2023 - to text and changed the format at the same time:
Google Sheets: convert text to date
Sometimes your dates may appear in a way that Google Sheets doesn't understand at all. And it doesn't really matter whether they are imported or you just fancy a certain view:
Unless you specify a custom format for each cell or change the locale of your spreadsheet, these dates will be formatted as text by default. You won't be able to use them in formulas or other calculations.
But here's the easiest solution for your Google Sheets: convert text to dates using the Power Tools add-on. It's literally a single radio button among other convert tools:
The tool recognizes all these custom formats in your Google Sheets and converts text to date so all cells become consistent and can be used for further reference:
This is it! I hope by now you know how to change date format in Google Sheets and convert dates to numbers or text. Feel free to share other cool ways in the comments section below. ;)