How to Use the MONTH() Function in SQL Server: A Detailed Guide

Rumman Ansari   Software Engineer   2024-07-21 09:42:22   5875  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Syntax:


Month()

Returns the 'Month number of the year' of the given date.

Code:


Select Month(GETDATE())

Returns the Month number of the year, based on the current system date and time.


Select Month('01/31/2012') 

Output:

The above code will produce the following result-


1



Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.