1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Format function in query

Discussion in 'SQL Server' started by shukla, Jul 5, 2009.

  1. shukla

    shukla New Member

    Joined:
    Jul 5, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi All!
    I am new to sql server 2005
    I want to use format function in sql query
    Format(dtfld,'dd-mmm-yyyy').
    How to use it ?:nonod:
    Also for numbers, format(no1,"0.00") :crazy:
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    What is your input format and what you would like the output to be formatted.
     
  3. shukla

    shukla New Member

    Joined:
    Jul 5, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    My database contains dt as "datetime" type.
    I want it in format as dd-mmm-yyyy
     
  4. naimish

    naimish New Member

    Joined:
    Jun 29, 2009
    Messages:
    1,046
    Likes Received:
    18
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    On Earth
    MS SQL Server 2005 provides CONVERT function to change or convert the DateTime formats.



    CONVERT Function syntax:

    Convert (datatype, datetime string, date style)
     

Share This Page