This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Attribute_filter_by_date
expandshrink

Attribute_filter_by_date

Attribute_filter_by_date

Wednesday 09 July 2014 12:25:27 pm - 2 replies

Hi ,

I have two attributes in an object called,published date and publishenddate.I want to com mpare them with current date.This is my code.But this is not working as expected ,any suggessions ? happy.gif Emoticon

 

$today = date("Y-m-d H:i:s"blunk.gif Emoticon;  

$now = strtotime($today);

$videosIndex = 0;$

videoparams = array(           

'Depth' => 1,           

'Offset' => 0,           

'SortBy' => array('sched'),           

'Limit' => 10 ,         

  'AttributeFilter' => array('and',array('video/sched_end', '>=', $now),array('video/sched', '<=', $now))

Wednesday 09 July 2014 1:39:28 pm

Hi upeksha,

as far as i know you need to take the timestamp.
eZ is storing date-fields as timestamps (not date-time-fields) in the database.

Just put the result of time() to the $now-variable. No need for the $today-variable anymore.

Thursday 10 July 2014 5:39:31 am

Thank you Steve.That works for me.Yes Ez publish is not easy happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from