problem in sqlserver date format

Posted by Manoj_B under Sql Server on 12/12/2012 | Points: 10 | Views : 975 | Status : [Member] | Replies : 3
I have a problem regarding in sqlserver date format.

my requirement is:-

i want to retrive date from table in '2nd Nov 2012 ', '4th Dec 2012 '.... like this.

i.e select dtmadmission from tblstudent where intstudentId=8

o/p should be 24th Dec 2011

Please help me. it's very urgent.

Any help will be very much helpful.

Thanks & Regards
Manoj Kumar



Responses

Posted by: Ranjeet_8 on: 12/12/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
try this
SELECT CONVERT(VARCHAR(12), YourColumnName, 106) AS AdmDate from YourTableName


Manoj_B, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/12/2012 [Member] Bronze | Points: 25

Up
0
Down
select CONVERT(VARCHAR(11), getdate(), 106) AS [DD MON YYYY] from sys.tables

for the words nd,th you need to format it manually, there are no build in functions
http://www.sql-server-helper.com/tips/date-formats.aspx

Thanks
Pavan Kumar
Mark Answer if this fits the need

Manoj_B, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandhyab on: 12/12/2012 [Member] Starter | Points: 25

Up
0
Down
SELECT CONVERT(VARCHAR(12), SYSDATETIME(), 107) AS [Mon DD, YYYY]

To know more about SQL Server 2008 Date Format,Refer This
http://www.sql-server-helper.com/sql-server-2008/sql-server-2008-date-format.aspx

Thanks & Regards

Manoj_B, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response