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
 General SQL Server Forums
 New to SQL Server Programming
 Date Format

Author  Topic 

naveengopinathasari
Yak Posting Veteran

60 Posts

Posted - 2011-07-11 : 08:38:05
I Have a requirement where the date and Time has to displayed in the User defined format which is not support by SQL SERVER defaults

for Example
MMM_DD_YYYY = JAN_01_2011
DD.MMM.YY = 01.JAN.11
DD/MMM/YYYY = 01/JAN/2011

like wise i have for Time and Number format too...
this is not possible with built functions of SQL SERVER
Please suggest or any idea i can go forward.



Lets unLearn

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-07-11 : 08:59:29
Replace all dots, slashes and underscores with space and try again.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-07-11 : 09:11:58
SELECT UPPER(REPLACE(CONVERT(VARCHAR(11),GETDATE(),0),' ','_')) --JUL_11_2011
SELECT UPPER(REPLACE(CONVERT(VARCHAR(11),GETDATE(),13),' ','.')) --11.JUL.2011
SELECT UPPER(REPLACE(CONVERT(VARCHAR(11),GETDATE(),13),' ','/')) --11/JUL/2011

--Ranjit
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-07-11 : 09:20:38
Where do you want to show formatted dates? If you use front end application, do formation there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -