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)
 How to convert the following date format

Author  Topic 

itnagaraj
Yak Posting Veteran

70 Posts

Posted - 2010-10-14 : 09:21:11
Hi,
How to convert the following date format.For Example

Select getdate()

This will Return
2010-10-14 19:01:30.000

i want the following format
Oct 2010

V.NAGARAJAN

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-14 : 09:30:51
This?

Select DateName(Month, GetDate()) + ' ' + Convert(VarChar(4), Year(GetDate()))


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-10-14 : 09:31:08
Do this in your front end app.

If you can't though, one way is select convert(varchar(3),datename(month,getdate())) + ' ' + convert(varchar(4),year(getdate()))

EDIT: i'm not fast enough with the post button..
Go to Top of Page

itnagaraj
Yak Posting Veteran

70 Posts

Posted - 2010-10-14 : 09:31:30
i got a solution.Don't worry abot this.

No Thanks.
quote:
Originally posted by itnagaraj

Hi,
How to convert the following date format.For Example

Select getdate()

This will Return
2010-10-14 19:01:30.000

i want the following format
Oct 2010

V.NAGARAJAN



V.NAGARAJAN
Go to Top of Page
   

- Advertisement -