Formatting Dates in SQL Server

Hello everyone,

In this article, I will give information about date formatting in SQL Server.

In SQL Server, in some cases, we may want to format the date as we want.

You can do this easily with the help of the codes below.

SELECT CONVERT(VARCHAR, GETDATE(), 1);
SELECT CONVERT(VARCHAR, GETDATE(), 2);
SELECT CONVERT(VARCHAR, GETDATE(), 3);
SELECT CONVERT(VARCHAR, GETDATE(), 4);
SELECT CONVERT(VARCHAR, GETDATE(), 5);
SELECT CONVERT(VARCHAR, GETDATE(), 6);
SELECT CONVERT(VARCHAR, GETDATE(), 7);
SELECT CONVERT(VARCHAR, GETDATE(), 10);
SELECT CONVERT(VARCHAR, GETDATE(), 11);
SELECT CONVERT(VARCHAR, GETDATE(), 12);
SELECT CONVERT(VARCHAR, GETDATE(), 100);
SELECT CONVERT(VARCHAR, GETDATE(), 101);
SELECT CONVERT(VARCHAR, GETDATE(), 102);
SELECT CONVERT(VARCHAR, GETDATE(), 103);
SELECT CONVERT(VARCHAR, GETDATE(), 104);
SELECT CONVERT(VARCHAR, GETDATE(), 105);
SELECT CONVERT(VARCHAR, GETDATE(), 106);
SELECT CONVERT(VARCHAR, GETDATE(), 107);
SELECT CONVERT(VARCHAR, GETDATE(), 108);
SELECT CONVERT(VARCHAR, GETDATE(), 109);
SELECT CONVERT(VARCHAR, GETDATE(), 110);
SELECT CONVERT(VARCHAR, GETDATE(), 111);
SELECT CONVERT(VARCHAR, GETDATE(), 112); 

--Aşağıdaki iki kod aynı sonucu verir 

SELECT CONVERT(VARCHAR, GETDATE(), 113);
SELECT CONVERT(VARCHAR, GETDATE(), 13);

SELECT CONVERT(VARCHAR, GETDATE(), 114);

The appearance formats of the query are as follows, in order.

Formatting Dates in SQL Server

Good luck to everyone in business and life.

168 Views

Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!