I have a field type ‘Date’ in my MySql table. What i want is when i retrieve information from a row, i want to be able to get only the Year from that date field. Or it could also be just the month or just the day. But the date in my date field must stay complete (YYYY-mm-dd).
suppose you wanted to filter rows based on the year, i.e. return only those rows for a specific year (for example, say the table has many rows for many different years)
then using the database YEAR() function in the WHERE clause becomes crucial
you do not want to return the entire table from the database to your php script, in order to use php’s date function to pick out the rows for the year you want