THE WORLD'S LARGEST WEB DEVELOPER SITE

SQL Server MONTH() Function

❮ SQL Server Functions

Example

Return the month (from 1 to 12) for a given date:

SELECT MONTH('2017/08/25') AS Month;
Try it Yourself »

Definition and Usage

The MONTH() function returns the month (from 1 to 12) for a given date.

Syntax

MONTH(date)

Parameter Values

Parameter Description
date Required. The date to return the month from

Technical Details

Works in: SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005

More Examples

Example

Return the month (from 1 to 12) for a given date:

SELECT MONTH('2017/05/25 09:08') AS Month;
Try it Yourself »

❮ SQL Server Functions