none
How to change the Date Format in the SQL Server RRS feed

  • Question

  • How to change the date format in the SQL Server level from 2012-08-30 00:00:00:000 --->  to mdy (8/30/2012 6:28:17 pm) for SQL Server 2008 R2.


    MRVSFLY

    Thursday, August 30, 2012 2:33 PM

Answers

All replies

  • SQL Server store datetime as 8-bytes binary value.

    You can submit command "SET DATEFORMAT mdy" to enforce only input datetime to be complied.
    But the output is depend on front end format.
    for example
    SSMS front end display datetime data-type as yyyy-mm-dd
    For .NET result set, you can set format via its property.
    It is difference for each front end.

    To enforce datetime output format, you have to CONVERT it to VARCHAR

    Thursday, August 30, 2012 4:04 PM
  • SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]


    Ramesh Babu Vavilla MCTS,MSBI

    Thursday, August 30, 2012 4:16 PM
  • For input or output?

    For ouput: You can't, since it is the client that present the binary data which is date/time into something humany readable. I.e., this has to be done in the client app. Or convert to a string in the SELECT statement.'

    For input, you have several options: SET DATEFORMAT, SET LANGUAGE and the languageof a login.

    More info here: http://www.karaszi.com/SQLServer/info_datetime.asp


    Tibor Karaszi, SQL Server MVP | web | blog

    Friday, August 31, 2012 6:33 AM
    Moderator
  • Read this

    http://blogs.msdn.com/b/sqlserverfaq/archive/2009/11/13/how-to-change-date-format-after-installing-sql-server.aspx


    Many Thanks & Best Regards, Hua Min

    Friday, August 31, 2012 7:00 AM