Tags: aurgument, bol, cast, convert, date, display, findy, format, function, programming, searched, sql, tia, yyyy

date format in m/d/yyyy

On Programmer » SQL

3,079 words with 5 Comments; publish: Wed, 28 May 2008 23:49:00 GMT; (200123.05, « »)

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

All Comments

Leave a comment...

  • 5 Comments
    • 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" <CallDBA.sql.questionfor.info.hotmail.com> wrote in message

      news:ux$eLl$mHHA.4624.sql.questionfor.info.TK2MSFTNGP04.phx.gbl...

      > 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

      >

      #1; Wed, 28 May 2008 23:50:00 GMT
    • 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

      #2; Wed, 28 May 2008 23:51:00 GMT
    • Thanks Plamen. It worked.

      Kay

      "Plamen Ratchev" <Plamen.sql.questionfor.info.SQLStudio.com> wrote in message

      news:u9MtQuBnHHA.4592.sql.questionfor.info.TK2MSFTNGP05.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

      >

      >

      #3; Wed, 28 May 2008 23:52:00 GMT
    • Those would be the "funky string manipulations" I mentioned! LOL

      --

      TheSQLGuru

      President

      Indicium Resources, Inc.

      "Plamen Ratchev" <Plamen.sql.questionfor.info.SQLStudio.com> wrote in message

      news:u9MtQuBnHHA.4592.sql.questionfor.info.TK2MSFTNGP05.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

      >

      >

      #4; Wed, 28 May 2008 23:53:00 GMT
    • On May 21, 10:47 pm, "Plamen Ratchev" <Pla....sql.questionfor.info.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!

      #5; Wed, 28 May 2008 23:54:00 GMT