Home > Back-end >  Convert date as '25/10/2022' to YYYY-MM-DD in Sql Server
Convert date as '25/10/2022' to YYYY-MM-DD in Sql Server

Time:01-11

I need to convert date as '25/10/2022' to YYYY-MM-DD. I am doing it as

select convert(varchar,'25/10/2022',106);

But it showing me the date as it is without converting. How should I convert it into required format.

CodePudding user response:

Try this:

SELECT CONVERT(DATE,'25/10/2022',103) AS date_type_col
      ,CONVERT(VARCHAR(10), CONVERT(DATE,'25/10/2022',103) , 121) AS text_type_col
  • Related