Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Haiiiiiiiiiiii

I can fetch the date from table in DB and disply mmm/yyyy formate not like dd/MM/yyyy. so, how to convert dd/mm/yyyy to mmm/yyyy in sql query or in c#. Please help me
Posted

In Sql Server Try some thing like this...
SQL
Select Cast(Getdate() as Varchar(3))+'/'+Cast(Year(GetDate()) as Varchar(4)) [Modified Format]

Output:
SQL
Modified Format
-------------
Oct/2013
 
Share this answer
 
v3
Comments
MANI 14 19-Oct-13 2:14am    
its working thank u..
You can give this a try..
SQL
SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11),GETDATE(), 106), 8), ' ', '/') AS [Mon/YYYY]   


Output:
SQL
Mon/YYYY
--------
Nov/2013
 
Share this answer
 
Check

SQL
SELECT CONVERT(VARCHAR(3), Datename(MONTH, Getdate()))
       + ' ' + CONVERT(VARCHAR, Year(Getdate()))

 
Share this answer
 
SQL
SELECT CAST(UPPER(DATENAME(MONTH, GETDATE())) AS VARCHAR(3)) + '/' + DATENAME(YEAR, GETDATE())
 
Share this answer
 
v4

http://www.dotnetperls.com/datetime-format[^]
refer this site dear.......
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900