Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to get the data form table like this.
"Tuesday, February 08, 2011 9:06:21 AM" "



how to convert (2011-04-07 15:17:18.460) to (Tuesday, February 08, 2011 9:06:21 AM )
Posted
Updated 14-Feb-12 20:30pm
v2

 
Share this answer
 
Try this:
SQL
declare @D as DateTime
set @D = GETDATE()
SELECT DATENAME(weekday, @d) + ', '  + CONVERT(NVARCHAR(MAX), @D, 109)

It will return
Wednesday, Feb 15 2012  7:43:41:067AM
Which is about as close as you will get without some tweaking.
To be honest, I would do this in my application code, rather than SQL: it is a lot more flexible and internationalizable.
 
Share this answer
 
Hello,

Please refer this http://msdn.microsoft.com/en-us/library/ms174395%28v=sql.90%29.aspx[^]

A small suggestion

SQL
select DATENAME(dw,GETDATE())
SELECT DATENAME(MONTH,GETDATE())
SELECT DAY(GETDATE())
SELECT YEAR(GETDATE())
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900