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)
 Using getDate() and convert to day month year

Author  Topic 

Pilot_Riaz
Starting Member

16 Posts

Posted - 2010-02-08 : 06:08:59
Hi,

To get today's date i use
select getDate()

Output = 2010-02-08 11:06:35.253

I would like to format it to this format 08 February 2010
It has to be this format as the function i call accepts the date parameter in this format

I have tried this which is close, but feb is in short, needs to be February
SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY]

Thanks, regards,
Riaz

Riaz

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-08 : 06:15:46
you should format the date in your front end application or reporting tool where the date is being displayed.

If you must do it in SQL side, use datename(month, getdate()) etc to concatenate to the required format


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-08 : 06:52:10
"to concatenate to the required format"

"... to STUFF() into a suitable format" ??
Go to Top of Page

Pilot_Riaz
Starting Member

16 Posts

Posted - 2010-02-08 : 06:54:14
Ah right, i see now.
Thanks for your help

Regards, Riaz

Riaz
Go to Top of Page
   

- Advertisement -