June 10, 2008 at 4:46 am
Hi,
Good afternoon
I want to display date date format like dd-MMM-YYYY
eg:-
My Requirement like this...
from Date is 27th April 2008 then i want diplay this from Dat like this format 27-Apr-2008
i tried like this
SELECT CONVERT( CHAR(6), fromDate, 106 )
FROM EMP
it gives out put like this :- 27 Apr 08
but i want out format like this 27-Apr - 2008
Plz hekp me to achive this
Regds,
Rclgoriparthi
June 10, 2008 at 5:36 am
That's an odd format - no default conversion for it.
So, it takes some string manipulation:
SELECT REPLACE(LEFT(CONVERT(VARCHAR,GETDATE(),13),11),' ','-')
June 10, 2008 at 6:07 am
SELECT REPLACE(CONVERT(CHAR(11), GETDATE(), 106), ' ', '-')
N 56°04'39.16"
E 12°55'05.25"
June 10, 2008 at 7:11 am
Please don't cross post.
The Monthname function will get you the month name, you can use datepart to extract the others, and then concatenate the strings together (CASTing required for the numbers).
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply