Page 1 of 2

Server Time Problem

Posted: Mon Aug 20, 2012 12:48 am
by allawrence
Script URL:
Version of script: 4.2.1
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: server time

Write your message below:

Settings|Misc

Server time reads 19:00, when you enter the tab, regardless of the time of day

Re: Server Time Problem

Posted: Mon Aug 20, 2012 11:15 am
by Klemen
Have you tried refreshing the page?

Re: Server Time Problem

Posted: Mon Aug 20, 2012 12:01 pm
by allawrence
Klemen wrote:Have you tried refreshing the page?
Yes...

Same time displays each time I open HESK... if I just let it sit there the time does increment (if that helps)

Re: Server Time Problem

Posted: Mon Aug 20, 2012 5:25 pm
by Klemen
That's really a strange one.

1. Does it help if you clear your browser cache, close all browser Windows then try again?

2. What browser and Operating system (on PC, not server) are you using?

3. What is your "Time format:" setting in HESK > Settings > Misc tab

4. If you save this code as "test.php", upload to your server and open in browser, what does it say:

Code: Select all

<?php
$tm = time();
$dt = date('Y-m-d H:i:s', $tm);
$server_time = date('H:i', strtotime($dt));
echo "Time 1: " . $tm . "<br />\n";
echo "Time 2: " . ($tm + 3600) . "<br />\n";
echo "Time 3: " . $dt . "<br />\n";
echo "Time 4: " . $server_time . "<br />\n";
?>
<script language="Javascript">
var server_time = "<?php echo $server_time; ?>";
var today = new Date();
document.write("Time 5: " + today + "<br />\n");
today.setHours(server_time.substr(0,server_time.indexOf(":")));
document.write("Time 6: " + today + "<br />\n");
today.setMinutes(server_time.substr(server_time.indexOf(":")+1));
document.write("Time 7: " + today + "<br />\n");
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
document.write("Time 8: " + h + ":" + m + ":" + s + "<br />\n");
</script>

Re: Server Time Problem

Posted: Mon Aug 20, 2012 7:15 pm
by allawrence
(1) No
(2) FF... latest version, XP
(3) Time Format: m-d-Y H:i:s
(4)
Time 1: 1345489997
Time 2: 1345493597
Time 3: 2012-08-20 15:13:17
Time 4: 15:13
Time 5: Mon Aug 20 2012 15:13:11 GMT-0400 (Eastern Daylight Time)
Time 6: Mon Aug 20 2012 15:13:11 GMT-0400 (Eastern Daylight Time)
Time 7: Mon Aug 20 2012 15:13:11 GMT-0400 (Eastern Daylight Time)
Time 8: 15:13:11

Re: Server Time Problem

Posted: Mon Aug 20, 2012 7:27 pm
by Klemen
This all looks fine so I see no reason why it shouldn't work in your HESK.

I just don't see a logical explanation. Have you been editing admin_settings.php file? Try uploading the original one again.

Re: Server Time Problem

Posted: Mon Aug 20, 2012 7:38 pm
by allawrence
Klemen wrote:This all looks fine so I see no reason why it shouldn't work in your HESK.

I just don't see a logical explanation. Have you been editing admin_settings.php file? Try uploading the original one again.
I have not done any work in the php files, now or ever!!

Uploaded 2.4.1 admin_settings.php... no change!

Re: Server Time Problem

Posted: Mon Aug 20, 2012 8:14 pm
by Klemen
If you are willing to give me access to your admin panel feel free to send me username/password for HESK admin in a PM.

Other than that I really have no idea what could be wrong here.

Re: Server Time Problem

Posted: Tue Aug 21, 2012 5:56 pm
by Klemen
Ha, I think I found the problem - the PHP "strtotime" function didn't work properly when time format was "m-d-Y H:i:s".

I changed it to "d-m-Y H:i:s" - switched d (day) and m (month) and it works correctly now.

This probably happens because of the default timezone setting on the server that uses "day month" format instead of "month day".

It's the first time I ever saw this error, thanks for giving me access so I was able to figure it out!

Re: Server Time Problem

Posted: Sun Dec 16, 2012 12:13 am
by allawrence
Back in August you figured out a somewhat related problem to what I am having now... getting these errors:

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/43/d151159610/htdocs/kseh/inc/common.inc.php on line 966

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/43/d151159610/htdocs/kseh/inc/common.inc.php on line 971

Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/43/d151159610/htdocs/kseh/admin/admin_settings.php on line 71

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /homepages/43/d151159610/htdocs/kseh/admin/admin_settings.php on line 71

Your assistance would be appreciated

Re: Server Time Problem

Posted: Sun Dec 16, 2012 9:00 am
by Klemen
It's a PHP configuration issue - you need to set a correct default date.timezone value in your php.ini file.

http://php.net/manual/en/datetime.configuration.php

Re: Server Time Problem

Posted: Sun Dec 16, 2012 1:39 pm
by allawrence
Interesting but perplexing....

The ONLY place I am getting these errors is on the Hesk admin page and on the Footer on the Hesk pages. The footer is used on ALL my pages and the Hesk admin page is the only one complaining.

Re: Server Time Problem

Posted: Mon Dec 17, 2012 3:26 pm
by Klemen
Perhaps your other pages don't use date functions?

Re: Server Time Problem

Posted: Mon Dec 17, 2012 3:53 pm
by allawrence
Klemen wrote:Perhaps your other pages don't use date functions?
The Footer contains a date function, same as used in the footer on the Hesk pages and ALL my other pages...

I will send this issue off to my ISP (1and1) and see if they messed with the php.ini file, I have not and would not know where to find it

Re: Server Time Problem

Posted: Sat Jan 05, 2013 2:35 pm
by allawrence
The errors generated relate to the version of PHP being used. 1and1 is using 5.4.10.
If I force the version to 5.2/5.3, via an htaccess entry for Hesk only, the errors disappear and all works well...