Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mfghazi
Starting Member
5 Posts |
Posted - 2009-06-25 : 15:43:33
|
| How can I display date as Friday, December 25, 2009 in T-SQL (SQL Server 2005)? |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2009-06-25 : 15:50:00
|
| Normally, you should do this at front end.. however check out BOL for CONVERT functions...Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
mfghazi
Starting Member
5 Posts |
Posted - 2009-06-25 : 16:14:01
|
| Thanks dinakar. I know it's very easy at front end, but if there is a situation when there is no front end, then it has to be done at back end.A UDF can be written but I was just looking if there is something built-in available. |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-06-25 : 16:28:13
|
| select datename(dw,getdate()) + ', ' + convert(varchar (11),getdate(),109)orselect datename(dw,getdate()) + ', ' + stuff(convert(varchar (11),getdate(),109),7,1,', ') |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-06-25 : 16:39:06
|
No direct conversion that I know of:SELECT DATENAME(WEEKDAY, CURRENT_TIMESTAMP) + ', ' + DATENAME(MONTH, CURRENT_TIMESTAMP) + ' ' + CAST(DAY(CURRENT_TIMESTAMP) AS VARCHAR(2)) + ', ' + CAST(YEAR(CURRENT_TIMESTAMP) AS VARCHAR(4)) |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2009-06-25 : 16:43:06
|
| [code]select DisplayDate = convert(varchar(30), datename(dw,getdate())+', '+datename(month,getdate())+' '+ datename(day,getdate())+', '+datename(year,getdate()))Results:DisplayDate------------------------------ Thursday, June 25, 2009[/code]CODO ERGO SUM |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-06-26 : 00:33:17
|
| Hi , see this link it will be useful for u http://www.sql-server-helper.com/tips/date-formats.aspx |
 |
|
|
|
|
|
|
|