Click here to Skip to main content
14,325,352 members
Rate this:
Please Sign up or sign in to vote.
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
Rate this:
Please Sign up or sign in to vote.

Solution 2

Try this:
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.
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

Hello,

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

A small suggestion

select DATENAME(dw,GETDATE())
SELECT DATENAME(MONTH,GETDATE())
SELECT DAY(GETDATE())
SELECT YEAR(GETDATE())
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100