Support for timezones?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Support for timezones?

Post by AndrewB »

what is "Support for timezones" and where do I configure it?
Thorsten
Posts: 15743
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

if you're living in Europe and your Server is hosted in the US you maybe need support for timezones. You can change this in inc/constants.php.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

OK. A drop down selection of +/- hours in the Admin would be nicer ;)
Thorsten
Posts: 15743
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

hm, I don't know. Do you change the timezone so often?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

It does not seem to work for me!

First, I am not sure what the value refers to. Is it seconds or minutes or hours? The file says [sec] but that does not seem to mean seconds.

I have tried various values. I tried -1, -2, -4, 0, 3, 10 and it does not seem to make logical changes!

it looks like if I set it to any number 1-9 then it adds that many minutes. So setting it to 5 will add 5 minutes to the times displayed. Setting it to 9 will add 9 minutes to the times displayed.

BUT, setting it to 10 seems to add 2 days and 21 hours to the displayed time!

setting it to a minus number is also confusing.

Can you please explain how I use this setting? Thanks.
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

Thorsten wrote:Hi,

hm, I don't know. Do you change the timezone so often?

bye
Thorsten
you are right! Once I get it set then it will stay the same. It is just trying to find the correct value to enter that is driving me crazy!
Thorsten
Posts: 15743
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

there's a bug in 1.4.0, sorry. This is the corrected makeDate() function inside the file functions.php:

Code: Select all

/*
 * Funktion für die Datumsumwandlung nach ISO 8601 | @@ Thorsten, 2001-04-30
 * Last Update: @@ Thorsten, 2004-07-27
 */
function makeDate($date)
{
    global $PMF_CONST;
    $offset = (60 * 60) * ($PMF_CONST["timezone"] / 100);
    $cuurent = strtotime(substr($date,0,4)."-".substr($date,4,2)."-".substr($date,6,2)." ".substr($date,8,2).":".substr($date,10,2));
    $timestamp = $cuurent + $offset;
    return date("Y-m-d H:i", $timestamp);
}
You can change the timezone in constants.php, e.g. set it to "-0400" for 4 hours before your timezone.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
AndrewB
Posts: 171
Joined: Fri Aug 22, 2003 11:15 pm
Contact:

Post by AndrewB »

beautiful :) it works great.

I think a couple of examples of how to use it should be added to a comment in the constants.php file.

(also, I changed $cuurent to $current)
Thorsten
Posts: 15743
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I already added an example. Good to see it works.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply