Forums

having todays date as part of the condition

darrenhallinan 05 Jul, 2016
Hi All

I am looking to only display results created today in a connection

I thought something like this would work . . but no!


<?php
   $form->data['current-date'] = date('Y-m-d');
?>
<?php
return array("created" LIKE => $form->data("current-date"));
?>


Any have any ideas on how to add todays date as a condition? I am guessing i would also have to have %today()% or something.

Thanks
GreyHead 05 Jul, 2016
Hi darrenhallinan,

A few typos to be fixed. And what do you want the condition to be - just to select those with today's date? Please try this
<?php
$today = date('Y-m-d');
return array( 'created LIKE' => '%'.$today.'%' );
?>

Note that you may have problems with local time zone settings that heed to be fixed.

Bob
This topic is locked and no more replies can be posted.