Default Date format to US,103

BHASKARAN, SACHIN 0 Reputation points
2023-10-26T11:43:26.2633333+00:00

I have a managed instance of SQLMI database . The database has been migrated from other RDBMS. The format of date in the RDBMS is mm/dd/yyyy . But when migrated to SQLMI the format is mm-dd-yyyy. The application need default data in the same format. i.e slash '/' instead of hyphen '-'. Will it be possible to change the default format to '/' so that data is stored in the same format and we don't have to use any convert function.

Is there any collation that support this format.

example:

select convert(varchar(255),getdate(),103) 'SLASH' ,getdate() 'HYPHEN'

SLASH HYPHEN

26/10/2023 2023-10-26

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 47,441 Reputation points
    2023-10-26T12:21:44.09+00:00

    select convert(varchar(255),getdate(),103)

    You used date format 103 and that's what you got; so what's the problem?

    See https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver16


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.