• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

Days between 2 dates in PHP

  • Views Views: 14,111
  • Last updated Last updated:
  • This gives the difference in days between a Date element and today, Alternatively you could swap 'today' with another date or field

    PHP:
    $nowdate = strtotime("{table___element}");
    $thendate = strtotime("today");
    $datediff = ($thendate - $nowdate);
    $diff = round($datediff / 86400);
    return $diff;

    It was used in a schedule task email plugin that required multiple conditions to be met, as follows

    PHP:
    $cond1 = ('{table___element}' == 'X');
    $nowdate = strtotime("{table___element}");
    $thendate = strtotime("today");
    $datediff = ($thendate - $nowdate);
    $diff = round($datediff / 86400);
    $cond2 = ($diff == X);
    return $cond1 <> $cond2;

    Send a reminder email only to the rows(users) that didn't update a record for more than 16 days.

    PHP:
    $date1 = strtotime("{table___update_raw}");
    $date2 = strtotime("{table___createdate_raw}");
    $date2 = strtotime("+16 day", $date2);
    return $date1 > $date2;
Back
Top