How can I extract the hour from a datetime in Google Sheets?

To extract the hour from a datetime in Google Sheets, users can utilize the HOUR function. This function takes a datetime value as its argument and returns the hour component of that datetime in a 24-hour format. This can be useful for organizing and analyzing time-sensitive data in a spreadsheet. By using the HOUR function, users can easily extract the hour from a datetime and use it for various calculations or formatting purposes. It is a simple and efficient way to manipulate datetime values in Google Sheets.

Google Sheets: Extract Hour from Datetime


You can use the HOUR function in Google Sheets to extract the hour from a datetime.

For example, you can use the following formula to extract the hour from the datetime in cell A2:

=HOUR(A2)

If cell A2 contains 1/1/2023 10:15 then this formula would return 10.

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

Example: Extract Hour from Datetime in Google Sheets

Suppose we have the following dataset in Google Sheets that shows the number of sales made during various dates and times for some company:

Suppose we would like to extract the hour from each datetime in column A.

To do so, we can type the following formula into cell C2:

=HOUR(A2)

We can then click and drag this formula down to each remaining cell in column C:

Google Sheets extract hour from datetime

Column C now displays only the hour value from each datetime in column A.

If you would also like to extract the minutes along with the hour, you can use the following formula instead:

=HOUR(A2)&":"&MINUTE(A2)

The following screenshot shows how to use this formula in practice:

Column C now contains both the hours and minutes for each datetime in column A.

Note that in this formula we used the MINUTE function to extract the minutes from the datetime and the & symbol to concatenate the hours and minutes.

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

Additional Resources

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

x