Time Zone Issues

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Mazurizi
Posts: 16
Joined: Wed Apr 18, 2012 9:07 am

Time Zone Issues

Post 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?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Time Zone Issues

Post 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?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Time Zone Issues

Post 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;
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Mazurizi
Posts: 16
Joined: Wed Apr 18, 2012 9:07 am

Re: Time Zone Issues

Post 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?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Time Zone Issues

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Mazurizi
Posts: 16
Joined: Wed Apr 18, 2012 9:07 am

Re: Time Zone Issues

Post 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?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Time Zone Issues

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Mazurizi
Posts: 16
Joined: Wed Apr 18, 2012 9:07 am

Re: Time Zone Issues

Post 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.
Post Reply