Page 1 of 1

Timezone Issue

Posted: 12 Mar 2019, 13:24
by dcdefiore_reiss
Good Morning,

I've installed and am customizing and configuring OpenCATS. Love it so far.

I've run into a problem with timezones though that I'm trying to figure out.

It's currently 8AM EST where I am. I'm running OpenCATS on an Ubuntu Server.

helpdesk@cen-s-web01:~$ date
Tue Mar 12 08:00:00 EDT 2019

PHP has the date correct as well:
Tuesday 12th of March 2019 08:00:00 AM

Now, if I have CATS set to an Offset of -5, emails that utilized %DATETIME% show the correct time, but the activity log inside of CATS shows a time of 4 hours in the future. So my 08:00:00AM activity shows up as 12:00:00 PM. If I change the offset in CATS to -9, the activity log shows the correct time, but the %DATETIME% variable that goes out in an email is messed up.

Any ideas?

Re: Timezone Issue

Posted: 13 Mar 2019, 12:55
by dcdefiore_reiss
So I suppose the function getAdjustedDate from DateUtility uses the system time, but my system time is correct. So I changed the function by removing the addition of the TimeZoneOffset

From lib\DateUtility.php
Code: Select all
public static function getAdjustedDate($format = 'U', $date = false)
        if ($date === false)
            $date = time();

        $unixTime = mktime(
            date('H', $date), //+ $_SESSION['CATS']->getTimeZoneOffset(),
            date('i', $date),
            date('s', $date),
            date('m', $date),
            date('d', $date),
            date('Y', $date)

        return date($format, $unixTime);