Page 1 of 1

Time Zone Issues

Posted: Tue Apr 18, 2017 12:50 pm
by Mazurizi
Version of script: 2 x version 2.7.3 and 1 x 2.5.3
What terms did you try when SEARCHING for a solution: Time and time zone

Write your message below:

We have 3 instances of Hesk installed on the same server and each of them has a different 'Current Hesk Time'.

I've created a PHP file with this and it is displaying the correct server time (different to what is showing in HESK):

Code: Select all

<?php
date_default_timezone_set('Europe/London');

$timestamp = time();
$date_time = date("d-m-Y (D) H:i:s", $timestamp);
echo "Current date and local time on this server is $date_time";
?>
I've tried manually changing the server offset but it doesn't work, and it seems once the number is too great it just resets back to 3am.

Server time is correct and same as the local time.

Timezone is set in PHP.ini - the php.ini is set from C:\Program Files - does it need to be moved to the C:\Windows folder?

Re: Time Zone Issues

Posted: Tue Apr 18, 2017 12:54 pm
by Klemen
I would set Europe/London timezone in php.ini and keep the offset in Hesk to 0.

Where the php.ini needs to be depends on your server setup, most likely in the folder where PHP is installed?

Re: Time Zone Issues

Posted: Tue Apr 18, 2017 12:58 pm
by Klemen
Or, in 2.7.3, you can try changing this in file inc/common.inc.php

Code: Select all

function hesk_setTimezone()
{
    global $hesk_settings;
to say

Code: Select all

function hesk_setTimezone()
{
    global $hesk_settings;
date_default_timezone_set('Europe/London');
return true;

Re: Time Zone Issues

Posted: Tue Apr 18, 2017 1:09 pm
by Mazurizi
It was already set in the PHP.ini in the install folder and the server time offset was set to 0.

The second fix worked for the new version - is it the same fix for the old version too? Or is there something else that I can change that will fix all 3 without adding that?

Re: Time Zone Issues

Posted: Tue Apr 18, 2017 1:12 pm
by Klemen
Older versions don't have that functions, so you can try adding it to the top of common.inc.php somewhere (before any functions).

Server-wide it is set in the php.ini, but it would take access to your server to verify where it needs to be set and if it has been setup correctly.

Re: Time Zone Issues

Posted: Tue Apr 18, 2017 1:18 pm
by Mazurizi
I can PM you the contents of the php.ini file if it is useful? Will that tell you where it needs to be too? If not will a PHP info tell you that?

Re: Time Zone Issues

Posted: Tue Apr 18, 2017 3:47 pm
by Klemen
PHPinfo should tell you, look for "Loaded Configuration File". You will also need to restart the server (or PHP service) after making changes to the ini file.

Re: Time Zone Issues

Posted: Wed Apr 19, 2017 7:53 am
by Mazurizi
I found part of the issue - it was using the PHP.ini from an older version of PHP that I have installed. Although on the older version the ticket history time is 2 hours ahead of the other times.

I'm not particularly bothered about this as it is another department's helpdesk and they don't use the feature.

Thanks for your help.