---
title: month function
description: Learn the syntax of the month function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/month
---

# `month` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the month component of the timestamp in `expr`. This function is a synonym for `extract(MONTH FROM expr)`.

> [!NOTE]
>
> When extracting fields from a `TIMESTAMP` (`TIMESTAMP_LTZ`), the result is based on the session timezone.

## Syntax

```
month(expr)
```

## Arguments

* `expr`: An `TIMESTAMP`, `TIMESTAMP_NTZ` expression, or a `STRING` of a valid timestamp format.

## Returns

An `INTEGER`.

## Examples

```sql
> SELECT month('2016-07-30');
 7
```

## Related functions

* [`dayofmonth` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofmonth.md)
* [`dayofweek` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofweek.md)
* [`dayofyear` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/dayofyear.md)
* [`day` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/day.md)
* [`hour` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/hour.md)
* [`minute` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/minute.md)
* [`monthname` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/monthname.md)
* [`extract` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/extract.md)
