Notification email - wrong time

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
haken
Posts: 3
Joined: Wed Sep 19, 2012 2:16 pm

Notification email - wrong time

Post by haken »

Script URL: pomoc.solidexpert.com
Version of script: 2.4.1
Hosting company: GoDaddy
URL of phpinfo.php: http://www.solidexpert.com/info.php
URL of session_test.php:
What terms did you try when SEARCHING for a solution: timezone server

Write your message below:
I needed to add 9 hours to server time to get correct HESK time. All events in Hesk are recorded properly with correct local time. The problem is with notification emails. All are sent with doubled timediff value.

Eg. Server time: 01:00
Hesk time : 10:00 (my local time)
Notification email time signature: 19:00

Customers see it as e-mail from future, their spam rules often delete those emails at once. Problem is both for phpmail and smtp

Is there a possibility to change some line of code to fix this? I see no chance to modify godaddy.com php.ini...
I understand that would be no problem if server time = hesk time (difference 0)
haken
Posts: 3
Joined: Wed Sep 19, 2012 2:16 pm

Re: Notification email - wrong time

Post by haken »

Ok. I have manage to edit php.ini file.
Now hesk time = server time, difference 0.

BUT all timestamps in hesk are moved -9 hours (despite good hesk time!). Is it a problem with mySQL date records? There is for sure no option to edit timezone for mysql on GoDaddy servers...

Please help;)
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Notification email - wrong time

Post by Klemen »

It's possible that their MySQL is set to a different time zone. I'm afraid I cannot help here.

However, emails shouldn't be blocked because of few hours time difference, SPAM filters should take in account that servers are in different time zones over the world.
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
haken
Posts: 3
Joined: Wed Sep 19, 2012 2:16 pm

Re: Notification email - wrong time

Post by haken »

Thanks for clearing things out!

I found a SQL statement for changing sql session timezone and I try to put it somewhere
Eg. in admin_ticket.php it works partially (change only last update date). This is strange.
I hoped for easy mods in admin_ticket.php and ticket.php

Code: Select all

$res = hesk_dbQuery("SET time_zone = `Europe/Warsaw`");
Is there a place to put this SQL statement that all dates collected from tables would be got in correct tomezone?
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Notification email - wrong time

Post by Klemen »

You can try adding it just above this code in inc/database.inc.php

Code: Select all

return $hesk_db_link;
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
vewert
Posts: 3
Joined: Sat Nov 24, 2012 10:09 pm

Re: Notification email - wrong time

Post by vewert »

I am having a similar problem.

haken,

Did you have any success setting the Time Zone in the SQL Statement?

I added:

Code: Select all

$res = hesk_dbQuery("SET time_zone = '-8:00';");
to database.inc.php, which sets it to PST, which is my local Time Zone.

This initially seemed to work, now all the timestamps in the tickets were showing correctly as PST. I then wondered what would happen for customers logging Tickets from other Time Zones. On a Test machine, I set the System Timezone to CST (-6:00), and added some replies to a ticket and found that the timestamps always showed as PST even for the computer set to CST. So, the way I have it now is:

Emails seems to show correct time
Timestamps in the client also show the time in PST, regardless of the timezone of the client.

Shouldn't the client always show the timestamps of the user's local Time Zone, regardless of the Time Zone of the database?

Any ideas?

Thanks,
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Notification email - wrong time

Post by Klemen »

The timestamp in HESK is always the server timestamp (corrected for example to the timezone your company is in if you use the adjust time settings), never client's.
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
vewert
Posts: 3
Joined: Sat Nov 24, 2012 10:09 pm

Re: Notification email - wrong time

Post by vewert »

Thanks, klemen for the quick reply.

So, just so I'm clear. If my server is in EST, and a Customer submits a ticket in PST, when the customer views their ticket in their browser, all timestamps will be displayed in EST.

I guess what I expected was, that the database would store the timestamp in some 'Time Zone neutral' format and then the browser would display the timestamps in the user's/browser's local Time Zone. I guess the issue with that is, trying to determine the Time Zone of the browser client.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Notification email - wrong time

Post by Klemen »

Exactly, in your example timestamp will be displayed in EST and yes, detecting timezone is indeed the issue here. If you have a system that requires users to login you can ask them what their timezone is, but Hesk was designed not to use any login hence there is no reliable way of detecting the timezone.
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
vewert
Posts: 3
Joined: Sat Nov 24, 2012 10:09 pm

Re: Notification email - wrong time

Post by vewert »

OK, thanks. Now that I understand how it works, I can work around it.
Post Reply