im trying to make an SQL table with custom date format
CREATE TABLE Basketbal.Bestuurslid (
`lidnummer` INT NOT NULL,
`begin_datum` DATE NOT NULL,
`eind_datum` DATE NULL,
`functie` VARCHAR(45) NULL,
PRIMARY KEY (`lidnummer`, `begin_datum`));
(I know it's in dutch)
im trying to make begin_datum
& eind_datum
in the following format:
1-jan-07 ('%e-%b-%y')
but I cant get it to work
any suggestions?
date
is an internal format in the database. You can convert it to (or from) a string using date_format()
(and str_to_date()
). That controls the character representation of the value, not the value itself. So, when you select from the table:
select date_format(begin_datum, '%e-%b-%y')
If you really feel strongly about not explicitly calling this function, you can put the date logic into a view and access the table through the view.