Wednesday, March 7, 2012

Date Format

I have a field with a datetime data type on it. I want
to run a query and return the datetime field in this
format (ex 21-JAN-2004). How can I do this?
select replace(CONVERT(CHAR(11),GETDATE(),113),' ','-')
"Vic" <vduran@.specpro-inc.com> wrote in message
news:19be901c44d7c$049edca0$a501280a@.phx.gbl...
> I have a field with a datetime data type on it. I want
> to run a query and return the datetime field in this
> format (ex 21-JAN-2004). How can I do this?
|||This worked!!! What does the 113 mean?

>--Original Message--
>select replace(CONVERT(CHAR(11),GETDATE(),113),' ','-')
>
>"Vic" <vduran@.specpro-inc.com> wrote in message
>news:19be901c44d7c$049edca0$a501280a@.phx.gbl...
>
>.
>
|||Read the documentation on Books Online for CONVERT and you'll find the different style codes.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Vic" <vduran@.specpro-inc.com> wrote in message news:19b6601c44d9b$41f93fe0$a301280a@.phx.gbl...[vbcol=seagreen]
> This worked!!! What does the 113 mean?

No comments:

Post a Comment