The last argument of CONVERT seems to determine the format used for parsing. Consult MSDN docs for CONVERT.

111 - the one you are using is Japan yy/mm/dd.

I guess the one you are looking for is 103, that is dd/mm/yyyy.

So you should try:

 SELECT convert(datetime, '23/07/2009', 103)
Answer from Grzegorz Oledzki on Stack Overflow
Discussions

T-SQL date conversion needed - datetime to mm/dd/yyyy hh:mm
Can’t seem to find answer to what seems like a simple question. I have a date that is returned 2022-02-07 18:53:36.000 I need to convert that date to mm/dd/yyyy hh:mm. Is that possible? More on community.spiceworks.com
🌐 community.spiceworks.com
6
6
February 9, 2022
sql server - Converting a varchar date into a date (dd/mm/yy) - Database Administrators Stack Exchange
I have a CSV file that has dates written like this: 250909,240909 and they get stored in a SQL Server database as varchars. How do I get it to convert them into dates so that it gets displayed lik... More on dba.stackexchange.com
🌐 dba.stackexchange.com
Converting date format in sqlserver
So, you do not store date in SQL by any format - only displays based on the local set of your server. If you want to show dd/mm/yyyy, use the Format method or Convert / Cast on the Date field to change the format. More on learn.microsoft.com
🌐 learn.microsoft.com
4
0
sql server convert date to string MM/DD/YYYY - Stack Overflow
I am using SQL Server 2008. I have the following: select convert(varchar(20),fmdate) from Sery How do I convert the date to string such that it show as MM/DD/YYYY More on stackoverflow.com
🌐 stackoverflow.com
🌐
W3Schools
w3schools.com › sql › func_sqlserver_convert.asp
SQL Server CONVERT() Function
String Functions: Asc Chr Concat with & CurDir Format InStr InstrRev LCase Left Len LTrim Mid Replace Right RTrim Space Split Str StrComp StrConv StrReverse Trim UCase Numeric Functions: Abs Atn Avg Cos Count Exp Fix Format Int Max Min Randomize Rnd Round Sgn Sqr Sum Val Date Functions: Date DateAdd DateDiff DatePart DateSerial DateValue Day Format Hour Minute Month MonthName Now Second Time TimeSerial TimeValue Weekday WeekdayName Year Other Functions: CurrentUser Environ IsDate IsNull IsNumeric SQL Quick Ref
🌐
MSSQLTips
mssqltips.com › home › sql date format examples using convert function
SQL Date Format Examples using SQL CONVERT Function
September 26, 2025 - The format is yyyy-mm-dd hh:mm:ss:nnn. ... The below queries use the GETDATE() function if you want to return the current date and time. Format the date or time without dividing characters and concatenate the date and time string: Another option ...
🌐
MSSQLTips
mssqltips.com › home › sql convert date to yyyymmdd
SQL Convert Date to YYYYMMDD
May 27, 2025 - Results: Example SQL Server dates loaded. Next, converting a DATE and DATETIME datatype to character 8 ‘yyyymmdd’ output using CONVERT and FORMAT functions.
🌐
Tutlane
tutlane.com › article › sql-server › convert-format-datetime-in-sql-server-with-examples
Convert (Format) DateTime in SQL Server with Examples - Tutlane
By using format code 112, we can convert the given datetime to yyyymmdd format using the CONVERT function in sql server. SELECT CONVERT(VARCHAR(30), GETDATE(), 112) ------------------------------------------ 20230321 ... By using format code 103, we can convert the given datetime to dd/mm/yyyy ...
Find elsewhere
Top answer
1 of 3
5

I understand your problem to be how to successfully convert the string into a DATE value. An undelimited string of integers is assumed to be Year-Month-Day order. (And, of course, I agree with the comments that dates should be stored in DATE data types in the database.)

Reviewing the MSDN CONVERT documentation does not show a built-in conversion for your string, but it is easy to work around.

http://msdn.microsoft.com/en-us/library/ms187928.aspx -- CAST and CONVERT

I changed the month to 8 to make it easier to double check. Using the CONVERT style option 3, you can do the following:

DECLARE @String VARCHAR(10);
DECLARE @DateValue DATE;
SET @String = '250809'; 

-- Convert your undelimited string DDMMYY into a DATE
-- First: Add / between the string parts.
SET @STRING = SUBSTRING(@String,1,2)+'/'+
     SUBSTRING(@String,3,2)+'/'+SUBSTRING(@String,5,2);
-- Second: Convert using STYLE 3 to get DD/MM/YY interpretation
SELECT @DateValue = CONVERT(Date, @String, 3);

-- Using the DATE 
-- Select the value in default Year-Month-Day
SELECT @DateValue AS DefaultFormat;    
-- Select the value formatted as dd/mm/yy
SELECT CONVERT(VARCHAR(20),@DateValue,3) AS [DD/MM/YY];

The results of the last two selects are:

DefaultFormat
-------------
2009-08-25

DD/MM/YY
--------
25/08/09

To get your DATE formatted in the way you want it, you have to insert the '/' delimiters then use the STYLE 3 in converting from the string to the DATE. (I am sure that there are other workarounds and conversion styles that would work as well.)

Likewise when displaying the DATE as you desire, you need to use STYLE 3

2 of 3
3

Another approach is to cast it directly to a date in SQL Server 2008 or above, then store it that way as @ypercube commented above. Assuming 2000 <= all expected years <= 2099:

DECLARE @d CHAR(6) = '250909';
SELECT DATEFROMPARTS('20'+RIGHT(@d,2),SUBSTRING(@d,3,2),LEFT(@d,2));

You may need to do things a little differently if you could have 250999 etc, then you would need some way to indicate whether that's 1999 or 2099, for example. This also doesn't handle validation (like the other answer, it will choke on values like 252525).

When you want to display the date, then format it at the display/presentation layer, but store it correctly in the database. I still question whether it is actually useful to display as ambiguous formats like 25/09/2009 - for that date specifically it's clearly September 25th, but are you sure your entire audience will always get 07/08/2009 correctly? While I'm in the USA that's July 8th, but last week I was in Canada, and I would expect that to be August 7th. Output formats like 2009-07-08 are much clearer and less prone to misinterpretation; even better would be July 8th, 2009 - but then that opens the door to folks using a different language. All that said, these formats can be completely controlled by the client application (C# has very powerful formatting functions), and shouldn't dictate how you actually store the data in the database. They should be stored as dates because you get automatic validation, all of the date/time functionality, etc. Stop storing dates as strings (and maybe even try to get the CSV to contain more reliable literal formats, like YYYYMMDD). Some useful reading perhaps:

  • https://sqlblog.org/2009/10/12/bad-habits-to-kick-choosing-the-wrong-data-type

  • https://sqlblog.org/2009/10/16/bad-habits-to-kick-mis-handling-date-range-queries

🌐
Database Guide
database.guide › convert-date-to-yyyymmdd-in-sql-server
Convert DATE to YYYYMMDD in SQL Server
February 24, 2023 - In SQL Server, we can use functions like CONVERT() or FORMAT() to convert a valid date type into a format like yyyymmdd. This format adheres to the ISO 8601 standard, which defines dates to be written as yyyymmdd, or when using delimiters, as yyyy-mm-dd.
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 1425205 › converting-date-format-in-sqlserver
Converting date format in sqlserver - Microsoft Q&A
So, you do not store date in SQL by any format - only displays based on the local set of your server. If you want to show dd/mm/yyyy, use the Format method or Convert / Cast on the Date field to change the format.
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › functions › cast-and-convert-transact-sql
CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn
DECLARE @d1 DATE, @dt1 DATETIME , @dt2 DATETIME2 SET @d1 = '1492-08-03' --This is okay; Minimum YYYY for DATE is 0001 SET @dt2 = CAST(@d1 AS DATETIME2) --This is okay; Minimum YYYY for DATETIME2 IS 0001 SET @dt1 = CAST(@d1 AS DATETIME) --This will error with (Msg 242) "The conversion of a date data type to a datetime data type resulted in an out-of-range value."
🌐
SQLTeam
forums.sqlteam.com › other sql server topics
How to change date format from YYMMDD to DD-MM-YYYY - Other SQL Server Topics - SQLTeam.com Forums
July 10, 2023 - Hi Team, Can any one help to convert date format YYMMDD to DD-MM-YYYY in a sql script. In data I have a date like 220504 which I want to convert into 04-05-2022. I have tried below given way but i am getting error. convert(varchar(10),cast(a.TRANSACTION_DATE as DATE),103) NEWDATE Thanks in advance
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › convert-varchar-date-to-ddmmyyyy-format-date
Convert varchar date to dd/mm/yyyy format date – SQLServerCentral Forums
October 18, 2018 - ... select convert(date,'7/30/2016',101) or if you just want a string with that format: select convert(varchar,convert(date,'7/30/2016',101),101) Actually, I want my string "7/30/2016" to convert to 30/7/2016 ... I want to convert data that is currently in a varchar column as "7/30/2016" to ...
🌐
CodingSight
codingsight.com › home › converting datetime to yyyy-mm-dd format in sql server
How to Convert DateTime to Date Format in SQL Server
July 24, 2023 - To convert all strings in the Arriv_Date column to the SQL Server date format YYYY-MM-DD, you can again use the CAST function. You need to specify the column name followed by the AS statement and the DATE type.
🌐
My Tec Bits
mytecbits.com › home › microsoft › sql server › convert datetime to yyyy-mm-dd format in sql server
Convert DateTime To YYYY-MM-DD Format In SQL Server | My Tec Bits
December 20, 2019 - FORMAT ( &lt;value>, &lt;format>) Where: &lt;value> = In our case this is a datetime or date calue, &lt;format> = In our case it's 'yyyy-MM-dd'. NOTE: Make sure yyyy in lower case, MM in upper case dd in lower case.
🌐
Database Guide
database.guide › convert-yyyymmdd-to-date-in-sql-server
Convert YYYYMMDD to DATE in SQL Server
When working with SQL Server, if we’re given a number that represents a date in the yyyymmdd format, we can use functions like CAST() or CONVERT() to convert that number to a valid date type.