symfony1 - Symfony - search table by month, year for datetime fields -


i trying create search filter on frontend module, filter 2 fields, months , years

i have items in db table, have datetime field.

i'd able create search, if select january , 2010 2 drop downs, items have datetimes like:

2010-01-24 10:50:52

2010-01-25 10:50:52

will listed

i using symfony 1.4 , propel orm

thank you

why dont try create 2 date , check if date between them, example (2010-01-01 >= $date && 2010-01-31 <= $date ). if so, in range , coincidences appear.

if absolutely have check month , year recommend using functions year(date) = $yourdate , month(date) = $yourmonth, functions should go along custom criteria , like:

$criterias->addcriteria(tablepeer::date_attribute,"year(". tablepeer::date_attribute .") = $year",criteria::custom); $criterias->addcriteria(tablepeer::date_attribute,"month(". tablepeer::date_attribute .") = $month",criteria::custom); 

here link mysqldatefunctions


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -