How to Use the DAY() Function in SQL Server: A Comprehensive Guide

Rumman Ansari   Software Engineer   2024-07-21 09:41:55   5505  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Syntax:


Day()

Returns the 'Day number of the Month' of the given date

Code:


Select DAY(GETDATE()) 

Returns the day number of the month, based on current system datetime.

Code:


Select DAY('01/31/2012') 

Output:

The above code will produce the following result-


31