Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

get month of date sql

-- Using MONTH() and GETDATE() function to fetch current month
SELECT MONTH(getdate()) AS "Present Month";

-- Using DATEPART() function and GETDATE() function
SELECT DATEPART(MONTH, GETDATE()) as "Present Month Of the Year";

-- Getting the name of the current month
SELECT FORMAT(GETDATE(),'MMMM') AS Month;
Source by www.educba.com #
 
PREVIOUS NEXT
Tagged: #month #date #sql
ADD COMMENT
Topic
Name
6+7 =