Server Time Problem

Helpdesk for my helpdesk software

Moderator: mkoch227

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

Re: Server Time Problem

Post by Klemen »

According to PHP manual, the notices for incorrect timezone settings are shown since PHP 5.1.0, so the most likely issue is your host doesn't have a (correct) timezone set in their PHP 5.4 php.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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

Post by allawrence »

Klemen wrote: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,

Installed 2.5 version... this problem appears to have not been resolved... I did change the format of the date and got it to react correctly, however, the date format is not the desirable one for the US....

Do hope this can be resolved

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

Re: Server Time Problem

Post by Klemen »

Thanks for the heads up - will see if I can come up with something more robust rather than relying on php.ini settings for the future.
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:Thanks for the heads up - will see if I can come up with something more robust rather than relying on php.ini settings for the future.
Good plan... looking forward to the resolution...

Thanks,

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

Re: Server Time Problem

Post by Klemen »

I'm looking into this now. According to PHP manual, "XX-XX-XXXX" is treated as UK format whereas "XX/XX/XXXX" is treated as US format.

If you change the syntax to this does it work fine in your case?

Code: Select all

m/d/Y H:i: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
allawrence
Posts: 56
Joined: Wed Sep 06, 2006 11:44 pm

Re: Server Time Problem

Post by allawrence »

Klemen wrote:I'm looking into this now. According to PHP manual, "XX-XX-XXXX" is treated as UK format whereas "XX/XX/XXXX" is treated as US format.

If you change the syntax to this does it work fine in your case?

Code: Select all

m/d/Y H:i:s
It appears as if that resolved the problem... date and time are displaying correctly... good find... not in UK, but still like the - instead of the /... :wink: :D

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

Re: Server Time Problem

Post by Klemen »

In that case leave the m/d/Y format in settings and try changing this in inc/common.inc.php

Code: Select all

return date($hesk_settings['timeformat'], $dt);
to

Code: Select all

return str_replace('/', '-', date($hesk_settings['timeformat'], $dt) );
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:In that case leave the m/d/Y format in settings and try changing this in inc/common.inc.php

Code: Select all

return date($hesk_settings['timeformat'], $dt);
to

Code: Select all

return str_replace('/', '-', date($hesk_settings['timeformat'], $dt) );
Thank you for the code... However, since I don't like to make code changes (since I inevitably will forget to make changes when new releases come out) I will have to give some thought to making the change!
Post Reply