View Full Version : Splitting the Date Field

12-16-2008, 04:02 AM
One of the pages of my site that I am developing a user types in for example 1992 in the textbox with a name "data_entryYear", When I click on the submit button, I want the database to search for all entries of 1992 from the database. The format of the date field in my database is yyyy-mm-dd

Thanks in advance for any help


Last Page
12-16-2008, 04:45 AM
I assume that you have MySQL database manager. In that case try to use MySQL function "YEAR".

SELECT * from Your_table_name WHERE YEAR(DATE_type_field_name) = $variable_representing_year;

I have not tested this.

12-16-2008, 05:59 AM
Gracias tanto