Skip to content
Advertisement

How to format date that looks like this (20200326) MYSQL

I have two fields with dates in them. I am trying to format them to look like 03/26/2020 instead of 20200326. So far my code looks like this changed most of it due to my job guidelines so I can’t show you the exact code.

SELECT tb.1,tb.2,CONCAT(tb.3,tb.4,tb.5) As Territory, tb.6 AS Start_date, tb.7 AS End Date

Advertisement

Answer

Use date_format():

select date_format(datecol, '%d/%m/%Y')
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement