• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Datediff using local time

thellie

Member
Hi,
I've had to adjust my date plugins to local time in order to get the correct date input - I'm in Thailand so its being input -7 hours (ie I input 1 Jan 2018 - date only, no time), and 31 Dec 2017 17.00.00 is added to the dbase.

But I need to create a date comparison field to get "duration of stay", and I'm stuck on the php syntax - it is returning 0 - could someone please show where I'm going wrong?

$enddate = '{vol_appform___enddate}';
$startdate = '{vol_appform___startdate}';
$tz_from = 'Asia/Bangkok';
$tz_to = 'UTC';

$end = new DateTime($enddate, new DateTimeZone($tz_from));
$end->setTimeZone(new DateTimeZone($tz_to));

$start = new DateTime($startdate, new DateTimeZone($tz_from));
$start->setTimeZone(new DateTimeZone($tz_to));

$datediff = ($start - $end);
$diff = round($datediff / 86400);
return $diff;

Thanks :)
 
I figured out my webhost is overriding the timezone... despite me changing it in the php.ini, .htaccess, and joomla settings.
I dropped a phpinfo.php file into my directory and it showed my timezone as America/Chicago.

Solved it by doing the following:
Add this to the top of the .htaccess file in the public_html root folder
Code:
<IfModule mod_suphp.c>
suPHP_ConfigPath /home1/username
<Files php.ini> order allow,deny
deny from all
</Files>
</IfModule>
nb - make sure you check the 'home' part as well - mine is home1

If your timezone is already set in your php.ini file, then it should show up now...

So, now I have to go back and revert all my local time to UTC...
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top