Forums / General / 'attribute_filter' with dates in a fetch function

'attribute_filter' with dates in a fetch function

Author Message

Anthony M.

Wednesday 06 September 2006 9:05:19 am

Hello,

I would like to filter on the date in my fetch function, with the attribute ‘attribute_filter’, like this :

fetch( ... 'attribute_filter', array( array( 'classe/champdate' , '>=' , currentdate() ) ) ... )

I would like to test if ‘champdate’ from the class ‘classe’ is greater or equal than the current date, but currentdate() return a timestamp, so is it possible to write the timestamp of ‘champdate’ to compare the timestamps ?? else with 'attribute_filter', we can compare 2 dates with the format 'JJ/MM/AAA' ???

Thanks for your help
Anthony

Anthony

Claudia Kosny

Wednesday 06 September 2006 12:31:01 pm

Hello Anthony

If you champdate attribute has the datatype date you can filter exactly the way you stated in your post, the comparison is done via the timestamp of the attribute.

If however your attribute champdate has the datatype string things get more complicated. You can transform the output of currentdate() to a more readable date using the datetime() function of EZ. But to compare the dates properly they must be of the format YYYYMMDD and the comparison must be done on a integer basis.
With your date format of 'JJ/MM/AAA' (what to me translates as day/month/year using two or three digits) a comparison is not possible as the first of an arbitrary month will always be earlier than the second of another month, no matter what the respective months (or years) are.

Greetings from Luxembourg

Claudia