HOUR
TheHOUR
function returns the hour component of a given time. This function is most commonly used to extract the hour value from a timestamp or a time value. The function takes one parameter, which is the time to extract the hour component from.
- How to use
HOUR
formula? - Examples of using
HOUR
formula HOUR
formula not working?- Similar formulas to
HOUR
Usage
Use the HOUR
formula with the syntax shown below, it has 1 required parameter:
- time (required):
The time value or timestamp from which to extract the hour component.
Examples
Here are a few example use cases that explain how to use theHOUR
formula in Google Sheets.
Extracting the hour from a timestamp
If you have a column of timestamps that you want to extract the hour component from, you can use the HOUR
function to do this. Simply reference the timestamp cell as the function's parameter.
Calculating hours worked
You can use the HOUR
function to calculate the number of hours worked by subtracting the start time from the end time and then extracting the hour component from the result.
Converting minutes to hours
To convert minutes to hours, you can divide the number of minutes by 60 and then use the HOUR
function to extract the hour component from the result.
Common Mistakes
HOUR
not working? Here are some common mistakes people make when using the HOUR
Google Sheets Formula:
Providing a non-time value
If you provide a cell reference or value that does not contain a time value as input to the HOUR formula, it will return an error. Make sure the input is a valid time value.
Providing an incorrect argument type
The HOUR formula only accepts time values as input. If you provide a date value or any other type of input, it will return an error. Make sure you are providing a valid time value as input.
Using the wrong time format
If the time value you are providing as input is not in a valid time format, the HOUR formula may return an incorrect value. Make sure the time value is in a valid format such as 'hh:mm:ss'.
Forgetting to wrap time value in quotes
If you are manually typing in the time value as input, make sure to wrap it in quotes. If you forget to do so, the HOUR formula may return an error.
Misunderstanding the output of the formula
The HOUR formula returns the hour component of a time value as a number between 0 and 23. Make sure you understand the output of the formula and how it corresponds to the original time value.
Related Formulas
The following functions are similar to HOUR
or are often used with it in a formula:
-
MINUTE
The
MINUTE
function in Google Sheets returns the minute of the hour for a given date or time value. It takes a single argument,time
, which is the date or time value to extract the minute from. -
SECOND
The
SECOND
function takes a time value and returns the seconds component of that time as a number between 0 and 59. This function is most commonly used to extract the seconds portion of a time value in order to perform calculations or comparisons based on seconds. -
DATE
The
DATE
formula is used to create a date object in Google Sheets. It takes three arguments: year, month, and day and returns a date. This formula is useful when you need to perform date calculations or create date-based charts and graphs. -
TIMEVALUE
The
TIMEVALUE
formula in Google Sheets is used to convert a time string into a time value in the format of HH:MM:SS. This formula is often used to extract the time value from a date/time string and use it for further calculations or formatting.
Learn More
You can learn more about the HOUR
Google Sheets function on Google Support.