change date format in sql - Microsoft Q&A (2024)

Hi,@Nikethan Antony

Welcome to Microsoft T-SQL Q&A Forum!

Here I provide a combination of convert method and replace, you may be able to learn more about date format conversion.Of course, as violel said, if use SQL Server 2012+ or later,
you can use FORMAT(value, format [, culture ]).

select CONVERT(VARCHAR(11),REPLACE(CONVERT(VARCHAR(11),datetime, 106), ' ', '-')) from #t1 

change date format in sql - Microsoft Q&A (1)
Best regards,
Bert Zhou

If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

change date format in sql - Microsoft Q&A (2024)
Top Articles
Latest Posts
Article information

Author: Carmelo Roob

Last Updated:

Views: 5937

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Carmelo Roob

Birthday: 1995-01-09

Address: Apt. 915 481 Sipes Cliff, New Gonzalobury, CO 80176

Phone: +6773780339780

Job: Sales Executive

Hobby: Gaming, Jogging, Rugby, Video gaming, Handball, Ice skating, Web surfing

Introduction: My name is Carmelo Roob, I am a modern, handsome, delightful, comfortable, attractive, vast, good person who loves writing and wants to share my knowledge and understanding with you.