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,375
    Likes Received:
    388
    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,043
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice