Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Sql Server Programming

date format in m/d/yyyy


Hi,

How can I display date in format m/d/yyyy. I searched BOL but could not
findy any aurgument for CONVERT or CAST function to deal with.

TIA
Kay

101 gives mm/dd/yyyy.  I think that is as close as you get to m/d/yyyy,
using some funky string manipulations to suck out the leading zeros if they
exist. :-)

--
TheSQLGuru
President
Indicium Resources, Inc.

"Kay" <Call@hotmail.com> wrote in message

news:ux$eLl$mHHA.4624@TK2MSFTNGP04.phx.gbl...

This type of formatting normally belongs to the reporting/presentation
layer. Here is one way to do it in SQL:

SELECT REPLACE(
               REPLACE(
                  REPLACE('m/d/yyyy', 'm', MONTH(CURRENT_TIMESTAMP)),
               'd', DAY(CURRENT_TIMESTAMP)),
           'yyyy', YEAR(CURRENT_TIMESTAMP))

HTH,

Plamen Ratchev
http://www.SQLStudio.com

-----------------------------------------------Reply-----------------------------------------------

Thanks Plamen. It worked.

Kay

"Plamen Ratchev" <Pla@SQLStudio.com> wrote in message

news:u9MtQuBnHHA.4592@TK2MSFTNGP05.phx.gbl...

Those would be the "funky string manipulations" I mentioned!  LOL

--
TheSQLGuru
President
Indicium Resources, Inc.

"Plamen Ratchev" <Pla@SQLStudio.com> wrote in message

news:u9MtQuBnHHA.4592@TK2MSFTNGP05.phx.gbl...

On May 21, 10:47 pm, "Plamen Ratchev" <Pla@SQLStudio.com> wrote:

> This type of formatting normally belongs to the reporting/presentation
> layer. Here is one way to do it in SQL:

> SELECT REPLACE(
>                REPLACE(
>                   REPLACE('m/d/yyyy', 'm', MONTH(CURRENT_TIMESTAMP)),
>                'd', DAY(CURRENT_TIMESTAMP)),
>            'yyyy', YEAR(CURRENT_TIMESTAMP))

> HTH,

> Plamen Ratchevhttp://www.SQLStudio.com

Different way of using replace.. me likey!
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc