Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 557 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert Month Number to Month Name Function in SQL

#11
Declare @MonthNumber int
SET @MonthNumber=DatePart(Month,GETDATE())
Select DateName( month , DateAdd( month , @MonthNumber , 0 ) - 1 )

Explaination:

1. First Decalre Variable `MonthNumber`
2. Get Current Month for `DatePart` which Return Month Number
3. Third Query Return Month Name

Reply

#12
i think this is enough to get month name when u have date.

SELECT DATENAME(month ,GETDATE())
Reply

#13
to_char(to_date(V_MONTH_NUM,'MM'),'MONTH')

where `V_MONTH_NUM` is the month number

SELECT to_char(to_date(V_MONTH_NUM,'MM'),'MONTH') from dual;
Reply

#14
select monthname(curdate());

OR

select monthname('2013-12-12');
Reply

#15
Working for me

SELECT MONTHNAME(<fieldname>) AS "Month Name" FROM <tablename> WHERE <condition>
Reply

#16
**Use this statement to convert Month numeric value to Month name.**

SELECT CONVERT(CHAR(3), DATENAME(MONTH, GETDATE()))
Reply

#17
Use this statement for getting month name:

DECLARE @date datetime
SET @date='2015/1/4 00:00:00'

SELECT CAST(DATENAME(month,@date ) AS CHAR(3))AS 'Month Name'

This will give you short month name. Like this: Jan, Feb, Mar, etc.
Reply

#18
Here is my solution using some information from others to solve a problem.

datename(month,dateadd(month,datepart(month,Help_HelpMain.Ticket_Closed_Date),-1)) as monthname
Reply

#19
**Use the Best way**

Select DateName( month , DateAdd( month , @MonthNumber , -1 ))
Reply

#20
Just subtract the current month from today's date, then add back your month number. Then use the datename function to give the full name all in 1 line.

print datename(month,dateadd(month,-month(getdate()) + 9,getdate()))
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through