After browsing the issues extensively I come to ask if anyone can help me with a particular setting of the date filter in a view.

I'm trying to filter dates between september of the year -2 and june of the year -1, or the previous academic year. However I'm not getting the syntax right. cf screenshot "date-filter between 2 dates".

the MySQL goes as follows :

AND (DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') >= '2010-09' AND DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2010-06')

when it should be :

AND (DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') >= '2009-09' AND DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2010-06')

Basically, the months are fixed values (september to june) but the years are relative (-1 and -2 from now).
Is there some documentation available for the complete syntax for this ?

CommentFileSizeAuthor
#1 date-filter02.gif9.63 KBlizuka
date-filter between 2 dates11.69 KBlizuka

Comments

lizuka’s picture

StatusFileSize
new9.63 KB

I found the answer to my question...
the syntax works with plain english !
So here goes, if that can help anyone :
date filter between (with relative months and absolute year values) default date -> 2 years ago september and to default date -> last year june (cf screenshot)

Thus making a correct MySQL query :

AND (DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') >= '2009-09' 
AND DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2010-06')
arlinsandbulte’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.