Server Time Problem

Helpdesk for my helpdesk software

Moderator: mkoch227

allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Server Time Problem

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

Re: Server Time Problem

Post by Klemen »

Have you tried refreshing the page?
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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

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

Re: Server Time Problem

Post 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>
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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

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

Re: Server Time Problem

Post 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.
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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

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

Re: Server Time Problem

Post 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.
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: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Server Time Problem

Post 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!
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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

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

Re: Server Time Problem

Post 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
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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

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

Re: Server Time Problem

Post by Klemen »

Perhaps your other pages don't use date functions?
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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

Post 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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

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