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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 convert date to 'Tue, 28 Oct 2008 1:52 pm' format

Author  Topic 

liangtp@hotmail.com
Starting Member

27 Posts

Posted - 2008-10-28 : 01:55:42
Guys,

Need your help.
What is the SQL statement to convert today's date to the format of "Tue, 28 Oct 2008 1:52 pm" ?

Thanks.

liangtp@hotmail.com
Starting Member

27 Posts

Posted - 2008-10-28 : 02:09:46
It is allright. I got it.

SELECT CASE DATEPART (dw, GETDATE())
WHEN 1 THEN 'Mon'
WHEN 2 Then 'Tue'
WHEN 3 THEN 'Wed'
WHEN 4 THEN 'Thu'
WHEN 5 THEN 'Fri'
WHEN 6 THEN 'Sat'
WHEN 7 THEN 'Sun'
END + ', ' + CONVERT(NVARCHAR, GETDATE(), 106) + RIGHT(CONVERT(NVARCHAR, GETDATE(), 100), 8)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-28 : 03:45:18
If this is for reports or anyother application, consider doing this formatting at your front end.
Go to Top of Page
   

- Advertisement -