SOLVED :-) Date conversion error.

ontarget

Active Member
Any ideas why
PHP:
 $date = $row->course_registrants___teacher_coursedates;
    var_dump($date);
    exit;
Shows the date from my calc field correctly as :
string(10) "30/09/2021"

But when i redeclare the $date in order to do a date comparison....
PHP:
$date = $row->course_registrants___teacher_coursedates;
//var_dump($date);
$date = date('Y-m-d', strtotime($date));
var_dump($date);
exit;
$month_3 = date('Y-m-d', strtotime('3 months ago'));
if (stuff here){ etc
I get
string(10) "1970-01-01"

I can only think there is a deprecation since moving to php7.4 / Fabrik 3.10? as my code works in a older php7.3 system but I can seem to find any evidence of this....
 
SOLVED!
It was my conversion that needed some work:
PHP:
$date = $row->course_registrants___teacher_coursedates;
  $date = strtr($date, '/', '-');
  $date = date('Y-m-d', strtotime($date));
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top