DATE_FORMAT to lose the zeros?

How do I write an select query with date format?
The db-name test has id, date and name.
I want the date month and day to have no zeros when they are under 10.
I tryed:
query(“SELECT * FROM test WHERE DATE_FORMAT(date, ‘%Y-%c-%e’) AND id=’'2”);
and I get: 2022-01-04
How do I lose the zeros?

By putting it in the SELECT … clause in the query, not in the WHERE … clause.

ok! Thanks, I got it to work.

Sponsor our Newsletter | Privacy Policy | Terms of Service