Solved

Convert Date

Posted on 2011-09-08
4
234 Views
Last Modified: 2012-05-12
Experts-

I am using the following query to grab a column in my db and convert the date.  I would like the full month to display if possible.  Currently, what I have is only displaying three characters in the month along with the day and year.  Any help would be appreciated

 SELECT CONVERT(VARCHAR(12), nextBillingDate_c, 107) AS [Month DD, YYYY]
  FROM members

Thanks
0
Comment
Question by:nmarano
  • 3
4 Comments
 
LVL 17

Accepted Solution

by:
OriNetworks earned 500 total points
ID: 36505053
SELECT DATENAME(MM, nextBillingDate_c) + ' ' + CAST(DAY(nextBillingDate_c) AS VARCHAR(2))+', ' +right(convert(varchar,nextBillingDate_c,101),4) AS [Month DD]
0
 
LVL 17

Expert Comment

by:OriNetworks
ID: 36505093
OR

select datename(MM,getdate()) +' ' + Convert(varchar,datepart(dd,getdate())) + ', ' + Convert(varchar,datepart(year,getdate()))
0
 
LVL 2

Author Closing Comment

by:nmarano
ID: 36505101
Awesome!  Thank you very much!
0
 
LVL 17

Expert Comment

by:OriNetworks
ID: 36505112
or to get it with the 2-digit day

SELECT datename(MM,getdate()) + ' ' + SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 2) +', ' + Convert(varchar,datepart(year,getdate()))
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to search for strings inside db views 4 41
Parse this column 6 35
Checking for column changes SQL 2014 4 24
SQL Server Serialization error 8 15
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question