# How dates and times work in Google Sheets

## How Dates Work

Though it may not be obvious initially, spreadsheets store dates as numbers instead of text. You can show dates in many different formats to the user, but their underlying value doesn’t change.

To illustrate the concept of the format changing but not the value, all of the rows in this table consist of 42734 displayed differently.

### Using Dates in Formulas

If you use dates in formulas, you must be careful to use them correctly. If you write something like =12/31/15-12/31/14, the result will be -.002, which wouldn’t be what you were looking for. Sheets will think you are dividing because of the slashes instead of showing dates. A similar error will occur if you try `=12-31-15-12-31-14`. The separators for dates, slashes or hyphens, are also arithmetic operators.

To work around this, use quotes to surround them. Let’s look at a few examples. The first example is misinterpreting slashes as division operators. The second example is misinterpreting dashes as subtraction operators. The formula is written and interpreted correctly using quotes to surround each date value until the third example.

Tip: If you are not in the United States, you may need to change your spreadsheet settings to show dates in the correct format for your location.

If you enter dates in a non-US format, you may get the #VALUE! error. Let’s take `December 31, 2016`, as an example.

If you hover over the error, the explanation says, “Function MINUS parameter 1 expects number values. but ’31/12/16′ is a text and cannot be coerced into a number.” In other words, Sheets cannot convert `30/12/16` to `42,734`, nor can it convert `31/12/16` to `42,735`, so it cannot subtract the two values.

### Subtracting Two Dates: Example 1

The same value is formatted in different ways in columns 2 and 3. The elapsed time is subtracting the two values. The result is the same regardless of the format of the cells above. Also, note that the spreadsheet formatted the result as an integer. If the result were formatted as a date, it would display “12/31/1899,” which would not make sense for this operation.

### Subtracting Two Dates: Example 2

The same value is formatted in different ways in columns 2 and 3. It is similar to example one, but you should look at this one too, just for giggles. Notice the extra day for leap year.

If want the duration between two times on different days, consider using our TIMEDIF icon. Otherwise, it is difficult to arrive at the correct value.

### The Beginning of Time

According to Google Sheets, time started on December 31, 1899. However, the dates before this will still exist, but negative integers will represent them.

## How Times Work

Times work similarly to dates in that they are shown as times, but they are numbers. One hour is .0417, which results from 1 hour divided by 24 hours in a day.

## How Dates and Times Work Together

Combining the two is easy once you understand how dates and times work.

### Live Examples in Sheets

Go to this spreadsheet for a live version of these examples so that you can study and use them anywhere you like.

## Related Tutorials

• ###### Difference Between Two Times in Seconds Using Google Sheets

Find the difference between two times in seconds.

• ###### Difference Between Two Times in Minutes Using Google Sheets

Find the amount of time passed between two times and display it in minutes.

• ###### Difference Between Two Times in Hours Using Google Sheets

Find the amount of time passed between two times and display it in hours.