I need to add an invoice date column, which is organized by day month and year (dd / mm / yy). How do I leave this pre-set time format in MySQL Workbench?
I need to add an invoice date column, which is organized by day month and year (dd / mm / yy). How do I leave this pre-set time format in MySQL Workbench?
If you store your dates with datetime
or date
there's no way, you have to deal with select
. It's quite simple:
SELECT data, DATE_FORMAT(data,'%d/%m/%Y') as data_formatada
FROM tabela
ORDER BY data ASC
This script should select the date the way it is ( data
), the date in the format dd / mm / yyyy (% with%) and sort from oldest to new. To reverse sort, change data_formatada
to ASC
.