Forums / All Other Contributions/Addons / Time Zone Offset Problem

Time Zone Offset Problem

Started by adamboyle on 10 Jul 2006, 3:26 PM · Views: 13,157

Results 1 to 20 of 36
10 Jul 2006, 3:26 PM
#1
adamboyle avatar

adamboyle

New Zenner

Join Date:
Nov 2005
Location:
Ipswich, UK
Posts:
18
Plugin Contributions:
0

Time Zone Offset Problem

Hello,

Ive just installed the Time Zone Offset contribution but im in a bit of a circle trying to get it to work on the admin side. I keep getting an error with the 1.3.0.2 version saying:

*"Time Zone Offset is set to +5 Hours. The difference between Server & Database time is -8 Hours." *

So, duly, I change the offset to -8 hours and the message swaps round:

"Time Zone Offset is set to -8 Hours. The difference between Server & Database time is 5 Hours."

My server is located in California and I am based in the UK. Im sure its something simple im missing but I cant quite figure out what it is. Any help would be grately appreciated!

Adam Boyle

11 Jul 2006, 12:40 AM
#2
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

To get this message you must have installed the 2 optional files.

One of these files you have to select your time zone by editing a TZ setting
admin/includes/extra_configures/time_offset.php
You can check if this is working correcting by checking the time & date displayed in admin. Apparantly this does not work on all servers. If it doesn't then there is no point installing the 2nd optional header file which is giving the warning message.

If this is correct you can install the optional header file which displays the difference between the new server time as displayed in admin and the time zone offset set for the mysql database.
admin/includes/header.php

+5 sounds about right for you so I would suspect you haven't edited
admin/includes/extra_configures/time_offset.php
to point to your time zone (the default setting is my zone in australia +14 hours)

Try editing this file to get the admin heading to display your time zone first, let us know it this works.

11 Jul 2006, 12:21 PM
#3
adamboyle avatar

adamboyle

New Zenner

Join Date:
Nov 2005
Location:
Ipswich, UK
Posts:
18
Plugin Contributions:
0

Re: Time Zone Offset Problem

Thanks for your reply, I think the problem must be with the server because no matter what i change the time zone offset value to the admin time/date remains the same.

Thanks very much for your help, just need to remove the optional header file!!

Adam Boyle

11 Jul 2006, 2:05 PM
#4
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

AdamBoyle:

Thanks for your reply, I think the problem must be with the server because no matter what i change the time zone offset value to the admin time/date remains the same.

Thanks very much for your help, just need to remove the optional header file!!

The time zone offset value in admin does not affect the admin time display.

You need to edit
admin/includes/extra_configures/time_offset.php
which contains..

<?php 
//You can modify the TZ (Time Zone) by using one of the following offsets
//TZ=America/Los_Angeles
//TZ=America/Denver
//TZ=America/Chicago
//TZ=America/New_York

putenv ('TZ=Australia/Melbourne'); 
?>

you need to change

putenv ('TZ=Australia/Melbourne');

to what ever your time zone is, you may have to google to find the valid text for your time zone

6 May 2009, 4:29 AM
#5
newfu avatar

newfu

New Zenner

Join Date:
Dec 2008
Posts:
36
Plugin Contributions:
0

Re: Time Zone Offset Problem

hi, thanks for the help previously.

so if i am from Singapore, what should i put ?

i tried to google but it always dun work.
Singapore, Singapore for GMT +8 ?

6 May 2009, 4:49 AM
#6
newfu avatar

newfu

New Zenner

Join Date:
Dec 2008
Posts:
36
Plugin Contributions:
0

Re: Time Zone Offset Problem

EDITED

http://sg.php.net/manual/en/timezones.php

**i found it myself, for the benefit of others, it uses PHP date function, so yup,
**

5 Oct 2009, 9:02 AM
#7
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Time Zone Offset Problem

This mod was working perfectly for me until an hour ago. I've not changed anything, but suddenly the following message has appeard in the header of my admin area:

Warning: putenv() [function.putenv]: Safe Mode warning: Cannot set environment variable 'TZ' - it's not in the allowed list in /home3/limelite/public_html/ADMIN/includes/extra_configures/time_offset.php on line 8
Warning TIME ZONE OFFSET ERROR! Time Zone Offset is set to +5 Hours. The difference between Server & Database time is -5 Hours.
Warning 2009-10-05 04:57:10: TZ Server Time
Warning 2009-10-05 09:57:10: Offset Database Server Time:

I remember I had similar messages at the install stage, but I added the optional files and edited the time_offset.php to this:

<?php 
//You can modify the TZ (Time Zone) by using one of the following offsets
//TZ=America/Los_Angeles
//TZ=America/Denver
//TZ=America/Chicago
//TZ=America/New_York

putenv ('TZ=Europe/London'); 
?>

Which did work, until now.

Anyone have any idea what's gone wrong?

I've tried changing the +5 in the admin My Store area to different cariables, +6 +4 etc., etc., but the same error every time.

Anyone?

2 Feb 2010, 6:19 AM
#8
defanci avatar

defanci

New Zenner

Join Date:
Dec 2009
Posts:
42
Plugin Contributions:
0

Re: Time Zone Offset Problem

Hi,

I was having the same problem too

"Time Zone Offset is set to +13 Hours. The difference between Server & Database time is 2 Hours."

When I change the offset to +2 hours and the message swaps round:

"Time Zone Offset is set to +2 Hours. The difference between Server & Database time is 13 Hours."

Then I added the different together and changed it to +15, fixed the problem.

2 Feb 2010, 7:21 AM
#9
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

Defanci:

Hi,

I was having the same problem too

"Time Zone Offset is set to +13 Hours. The difference between Server & Database time is 2 Hours."

When I change the offset to +2 hours and the message swaps round:

"Time Zone Offset is set to +2 Hours. The difference between Server & Database time is 13 Hours."

Then I added the different together and changed it to +15, fixed the problem.

Its a bit cryptic...
When its set to +13 hours. It telling you that it is NOW +2 hours out

So...... Try +15 hours (+13 +2)

24 Feb 2010, 11:30 AM
#10
totalsam avatar

totalsam

Zen Follower

Join Date:
Jan 2009
Posts:
126
Plugin Contributions:
0

Re: Time Zone Offset Problem

Hey,

So how would you integrate this with ZC. I know the Time Zone Offset mod used MySQL functions to change the date, but there is apparently a better way to do it with php now pho has improved. Anyone got any ideas how to do this?

24 Feb 2010, 12:36 PM
#11
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

totalsam:

Hey,

So how would you integrate this with ZC. I know the Time Zone Offset mod used MySQL functions to change the date, but there is apparently a better way to do it with php now pho has improved. Anyone got any ideas how to do this?

There is 2 parts
Setting the php time
and fixing the mysql time

This mod is designed to adjust the mysql database time

The php time can be set with the set TZ=(your country/city)

4 May 2010, 10:31 AM
#12
badger64 avatar

badger64

New Zenner

Join Date:
Mar 2010
Posts:
41
Plugin Contributions:
0

Re: Time Zone Offset Problem

Hi all

I know this thread is abit old but my host is based in the states and I'm in the uk.

Put this code in the .htaccess in the root of your site.

SetEnv TZ Europe/London

Works for me. Hope it helps.

Rgds
Badger

20 May 2010, 3:56 PM
#13
bear1728 avatar

bear1728

New Zenner

Join Date:
Jul 2009
Posts:
86
Plugin Contributions:
0

Re: Time Zone Offset Problem

this mod is so useful, i wonder if i could also set the time of reviews to my local time just as what it does to create_account and customer_order ?

20 May 2010, 3:58 PM
#14
bear1728 avatar

bear1728

New Zenner

Join Date:
Jul 2009
Posts:
86
Plugin Contributions:
0

Re: Time Zone Offset Problem

i use zencart 1.38a, do i need to update time zone offset mod to the newest version published on may 2nd 2010 ?

20 May 2010, 10:38 PM
#15
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

bear1728:

this mod is so useful, i wonder if i could also set the time of reviews to my local time just as what it does to create_account and customer_order ?

The basic process is here
http://www.zen-cart.com/forum/showpost.php?p=777481&postcount=111

Just find the relevent files that apply to your situation to alter

20 May 2010, 10:39 PM
#16
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

bear1728:

i use zencart 1.38a, do i need to update time zone offset mod to the newest version published on may 2nd 2010 ?

No you don't
Use the files for 1.38a

22 May 2010, 7:12 AM
#17
bear1728 avatar

bear1728

New Zenner

Join Date:
Jul 2009
Posts:
86
Plugin Contributions:
0

Re: Time Zone Offset Problem

thanks
then what do i set the customer reviews time to my local time?

25 May 2010, 1:54 AM
#18
bear1728 avatar

bear1728

New Zenner

Join Date:
Jul 2009
Posts:
86
Plugin Contributions:
0

Re: Time Zone Offset Problem

i didn't notice your first response to my questions :smile:

i check that post then, i find totally 2 now() concerning reviews

/admin/reviews.php
Line #30 : last_modified = now() where reviews_id = '" . (int)$reviews_id . "'");

/includes/modules/pages/product_reviews_write/header_php.php
VALUES (:productsID, :customersID, :customersName, :rating, now(), " . $review_status . ")";

i should modify these 2 now() above? or any other files i need to modify?

25 May 2010, 2:20 AM
#19
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Zone Offset Problem

bear1728:

i didn't notice your first response to my questions :smile:

i check that post then, i find totally 2 now() concerning reviews

/admin/reviews.php
Line #30 : last_modified = now() where reviews_id = '" . (int)$reviews_id . "'");

/includes/modules/pages/product_reviews_write/header_php.php
VALUES (:productsID, :customersID, :customersName, :rating, now(), " . $review_status . ")";

i should modify these 2 now() above? or any other files i need to modify?

I have never used reviews so have never had the need to alter these.
The 2 lines look right so try it and see if it works correctly for you

26 May 2010, 3:07 AM
#20
bear1728 avatar

bear1728

New Zenner

Join Date:
Jul 2009
Posts:
86
Plugin Contributions:
0

Re: Time Zone Offset Problem

i modified those 2 files, it works :clap: