0 votes
1 view
in SQL by (37.2k points)

Can anyone explain to me how to change the date format in SQL?

1 Answer

0 votes
by (90.2k points)

We can use CONVERT() function to change the date format in SQL. Here are the few examples of how to change date format using CONVERT() function:

SELECT CONVERT (varchar, getdate(), 1) to get the date in MM/DD/YYYY format i.e. 04/25/2020

SELECT CONVERT (varchar, getdate(), 23) to get the date in YYYY-MM-DD format i.e. 2020-04-25

SELECT CONVERT (varchar, getdate(), 4) to get the date in DD.MM.YY format 25.04.2020

You can go through this SQL tutorial blog to know more about date and time conversions

Related questions

0 votes
1 answer
asked May 6 in SQL by Sudhir_1997 (37.2k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Apr 19 in SQL by Sudhir_1997 (37.2k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...