That task should be done by the next layer up in your software stack. SQL is a data repository, not a presentation system

You can do it with

CONVERT(VARCHAR(10), fmdate(), 101)

But you shouldn't

Answer from TFD on Stack Overflow
🌐
MSSQLTips
mssqltips.com › home › sql date format examples using convert function
SQL Date Format Examples using SQL CONVERT Function
September 26, 2025 - --SELECT a datetime column as a string formatted dd/mm/yyyy (4 digit year) SELECT TOP 3 CONVERT(CHAR(10), ExpectedDeliveryDate, 103) ExpectedDeliveryDateFormattedAsText FROM Purchasing.PurchaseOrders WHERE OrderDate < @Datetime; --SELECT a datetime column as a string formatted dd/mm/yy (2 digit year) SELECT TOP 3 CONVERT(CHAR(8), ExpectedDeliveryDate, 3) ExpectedDeliveryDateFormattedAsText FROM Purchasing.PurchaseOrders WHERE OrderDate < @Datetime;
🌐
W3Schools
w3schools.com › sql › func_sqlserver_convert.asp
SQL Server CONVERT() Function
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
Discussions

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
How do i convert yyyymmdd into mmmm (text)
This kind of stuff is why you just make a date table in every database. Makes this trivial and solves a ton of other problems. As for forcing it out of this format, I don't think you need anything particularly long. If invoice_date is a string - datename(month,convert(date,invoice_date)) If invoice_date is an integer - datename(month,convert(date,convert(char(8),20220224))) More on reddit.com
🌐 r/SQLServer
11
5
February 23, 2024
How to change date format from YYMMDD to DD-MM-YYYY
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. c… More on forums.sqlteam.com
🌐 forums.sqlteam.com
0
0
July 10, 2023
sql server - SQL Convert 'yyyymmdd date' to 'mm/dd/yyyy' date - Stack Overflow
Thought I could use convert(varchar(10),DateColumn,101) like I do for most date to date conversions, but the output is the same as the input, yyyymmdd More on stackoverflow.com
🌐 stackoverflow.com
🌐
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. c…
Find elsewhere
🌐
InterSystems
community.intersystems.com › post › sql-convert-yyyymmdd-string-mmddyyyy
SQL Convert yyyymmdd string to mm/dd/yyyy | InterSystems Developer
2 0 https://community.intersystems.com/post/sql-convert-yyyymmdd-string-mmddyyyy#comment-39181 ... Funny, I learnt a similar approach by the numbers many moons ago. ... That will convert the text in the first argument (a string) using the format in the second parameter into a date, which will be displayed using the current selectmode.
🌐
MSSQLTips
mssqltips.com › home › sql convert date to yyyymmdd
SQL Convert Date to YYYYMMDD
May 27, 2025 - Results: Below shows the results of converting CHAR ‘yyyymmdd’ to a DATE and DATETIME data types! SQL does this gracefully.
🌐
Stack Overflow
stackoverflow.com › questions › 71651161 › convert-varchar-date-format-from-yyyy-mm-dd-to-yyyymmdd-in-sql
sql server - Convert Varchar date format from yyyy-MM-dd to yyyyMMdd in SQL - Stack Overflow
Hi I am trying to convert Varchar date format from yyyy-MM-dd to yyyyMMdd in SQL.I tried the below approaches but nothing is working. Declare @doj VARCHAR(10) Set @doj='2022-01-01' Select convert (
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › convert-field-from-yyyymmdd-format-to-mmddyyyy
Convert field from YYYYMMDD format to MM/DD/YYYY ? – SQLServerCentral Forums
November 19, 2012 - Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/ Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/ Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/ Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/ ... You are right mycolumn is defined as decimal in its DDL statement. ... You are right mycolumn is defined as decimal in its DDL statement. ... You are right mycolumn is defined as decimal in its DDL statement. ... To work with it as is you need to make sure you that your dateformat is the same as the table is stored and that you don't have any values that are not valid datetimes values.
🌐
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 101, we can convert the given datetime to mm/dd/yyyy format. SELECT CONVERT(VARCHAR(30), GETDATE(), 101) ------------------------------------------ 03/22/2023 ... By using format code 112, we can convert the given datetime to yyyymmdd 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
When you convert between datetimeoffset and the character types char, nchar, nvarchar, and varchar, the converted time zone offset part should always have double digits for both HH and MM.
🌐
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.
Top answer
1 of 3
1

Hi @Raj D ,

Here is how to convert text as a DATE data type.
After that you can format it at will by using CONVERT() or FORMAT() functions.

SQL

-- DDL and sample data population, start  
DECLARE @processdata TABLE ([ProcessDate] NVARCHAR(255) NOT NULL);  
INSERT @processdata VALUES  
('Sat May 30 2020 14:19:55 GMT-0700 (Pacific Daylight Time)'),  
('Sat May 30 2020 14:19:55');  
-- DDL and sample data population, end  

  
DECLARE @separator CHAR(1) = SPACE(1);  
  
SELECT *   
 , TRY_CAST('' +   
   REPLACE([ProcessDate], @separator, '') +   
   '' AS XML)  
 .value('concat((/root/r[4]/text())[1],"-", (/root/r[2]/text())[1],"-", (/root/r[3]/text())[1])', 'DATE') AS Result  
FROM @processdata;  

;WITH rs AS  
(  
 SELECT *   
 , TRY_CAST('' +   
   REPLACE([ProcessDate], @separator, '') +   
   '' AS XML)  
 .value('concat((/root/r[4]/text())[1],"-", (/root/r[2]/text())[1],"-", (/root/r[3]/text())[1])', 'DATE') AS Result  
 FROM @processdata  
)  
SELECT *   
 , TRY_CONVERT(VARCHAR(10), rs.result, 101) AS [Converted]  
 , FORMAT(rs.result, 'MM/dd/yyyy') AS [Formatted]  
FROM rs;  

Output

+-----------------------------------------------------------+------------+  
|                        ProcessDate                        |   Result   |  
+-----------------------------------------------------------+------------+  
| Sat May 30 2020 14:19:55 GMT-0700 (Pacific Daylight Time) | 2020-05-30 |  
| Sat May 30 2020 14:19:55                                  | 2020-05-30 |  
+-----------------------------------------------------------+------------+  
2 of 3
1
SELECT try_convert(date, substring(ProcessDate, 5, 11))
FROM  @processdata

I am here assuming that month names are always three letters and dates are always two digits. To keep it simple, I'm ignoring the time part.

You should always store date and time values in proper data types; you should never store them as strings. Never!

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

🌐
SQL Shack
sqlshack.com › sql-convert-date-functions-and-formats
SQL Convert Date functions and formats
May 21, 2021 - We can combine the SQL DATEADD and CONVERT functions to get output in desired DateTime formats. Suppose, in the previous example; we want a date format in of MMM DD, YYYY.
🌐
Microsoft Community Hub
techcommunity.microsoft.com › microsoft community hub › communities › products › sql server › sql server
Convert DATETIME to YYYYMMDD | Microsoft Community Hub
Hello, I'm struggling to work out how to achieve today's date in numbers using GETDATE(). The result I need is 20230524. So today's date in 8...