'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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:01:31
Script start
Timing: Jan 18 2025 16:01:31
Module start 'layout'
Timing: Jan 18 2025 16:01:31
Module start 'content'
Timing: Jan 18 2025 16:01:31
Module end 'content'
Timing: Jan 18 2025 16:01:31
Script end

Main resources:

Total runtime0.0177 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.0391152.6406
Module start 'layout' 0.00680.0035 740.679739.4766
Module start 'content' 0.01030.0052 780.156389.3516
Module end 'content' 0.01550.0022 869.507830.3047
Script end 0.0176  899.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002815.5868140.0002
Check MTime0.00116.4780140.0001
Mysql Total
Database connection0.00105.621710.0010
Mysqli_queries0.003117.663430.0010
Looping result0.00000.095710.0000
Template Total0.001810.310.0018
Template load0.00095.090410.0009
Template processing0.00095.198310.0009
Override
Cache load0.00063.551810.0006
General
dbfile0.00031.936480.0000
String conversion0.00000.052640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs