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 2000 Forums
 SQL Server Development (2000)
 Expanded Date

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-10-18 : 17:04:50
I thought I posted this earlier, but do not see the post. Apologies if this appears somewhere else.

I need to format a date in an SQL SP in a full month format like:

December 30, 2002

I see only abbreviated formats documented in BOL. Do I need to write a UDF or is there a CAST / CONVERT solution.

Thanks,

Sam

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-10-18 : 17:21:27
SELECT DateName(month, getdate()) + ' ' + DateName(day, getdate()) + ', ' +
DateName(year, getdate())

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-10-18 : 17:24:19
SELECT CONVERT(varchar, GetDate(), 107), CONVERT(varchar, GetDate(), 109)

I think 107 is what you are looking for.

Michael
[edit]
I didn't notice, but mine returns the Month abbreviation, not the full month name. Sniped by rob, as usual :) You da man Rob.
[/edit]

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>

Edited by - michaelp on 10/18/2002 17:26:11
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2002-10-18 : 17:57:50
Rob,

Thanks. Thanks MichaelP too.

Sam

Go to Top of Page
   

- Advertisement -