# Excel HOUR function

## Summary

The Excel HOUR function extracts the hour component from a time or datetime value, returning it as a number between 0 and 23. This function is particularly valuable when working with time data, allowing for the isolation of the hour part for various calculations or for integration with other date and time functions.
##### Syntax
```				```
=HOUR(serial_number)
```
```
• serial_number: A valid Excel time or datetime from which the hour is to be extracted.
##### Return value
A number representing the hour part of the time, within a 24-hour range (0 to 23).

## How to use

The HOUR function can be applied to any valid Excel time or datetime value to extract just the hour portion. It can be especially useful in combination with other time functions or when parsing datetime values for analysis or scheduling purposes.

## Examples

##### Simple HOUR

Basic Hour Extraction: Extracting the hour from a given time:

```				```
=HOUR("22:45")
```
```
This formula returns 22, representing the hour component of the time 10:45 PM.
##### HOUR and TIME

Adjusting Time to a Specific Minute and Second: Combining HOUR with the TIME function to adjust time:

```				```
=TIME(HOUR(A1), 0, 0)
```
```

Assuming A1 contains a time, this formula uses HOUR to extract the hour from A1 and then sets the minutes and seconds to 00:00, effectively rounding the time down to the start of that hour.

##### HOUR with Date Value
Extracting Hour from a DateTime Value: Extracting the hour component from a date and time combination:
```				```
=HOUR(A1)
```
```
If A1 contains a datetime value (e.g., “2021-07-15 14:30”), this formula extracts and returns the hour part of the datetime, which is 14 in this case.