bestempire

Topic: Need to fix time zone for JB site

Hello,

How can I set the time zone for my website. I have used

SetEnv TZ :Asia/Saigon

in my .htaccess but it still doesnot work

redjumpsuit

Re: Need to fix time zone for JB site

you need to add this in config.php, where is says romania there

Monetize your job board using a simple PayPal payment solution for jobberBase 1.9.1!

putypuruty

Re: Need to fix time zone for JB site

More specifically, you'll have to change date_default_timezone_set('Europe/Bucharest'); to what you need (in config.php)

cloudduster

Re: Need to fix time zone for JB site

I've tried using the date_default_timezone_set() but it's not working as well.

putypuruty

Re: Need to fix time zone for JB site

Can you please post here what exactly did you try?

cloudduster

Re: Need to fix time zone for JB site

hi putypuruty! thanks for the quick reply.

I changed my config.php to reflect this one

date_default_timezone_set('Asia/Hong_Kong');

but all my posts still reflect Jan 14th instead of Jan 15th. (I usually post around 7am Jan 15th)

I also tried the GMT+8 but didn't work out as well.

EDITED.

Posts made around 1pm or 2pm, get Jan 15 date stamped on them. Anything earlier than this period gets Jan 14th.

Last edited by cloudduster (2011-01-15 02:14:31)

putypuruty

Re: Need to fix time zone for JB site

Sorry to ask, but you've changed the line

Code:
date_default_timezone_set('Europe/London');

to

Code:
date_default_timezone_set('Asia/Hong_Kong');

right?

I'm asking because 2 posts above I was saying what to do for an older jobberbase version. So, I hope you've edited the existing line instead of adding a new line with the new time zone.

Anyhow, I assume that the problem is caused by the fact that inside the SQL queries, the mysql database server's current time is used (the function now()) and not php's time (which would take into consideration the time zone). If the database server is on a different time zone, then you can run into the problem that you've just mentioned. I guess that you're site is hosted somewhere in the US or Europe and thus the database server's time is not the time in Hong Kong.

The truth is that this is actually a bug in jobberbase, I wonder why we didn't discover this sooner.

I don't know what workaround to suggest for the time being other than hosting your site at a company in Hong Kong.

putypuruty

Re: Need to fix time zone for JB site

Sorry, I was a little bit hasty with my previous response.

The fix is actually pretty simple: open _config/config.php and add the following line

Code:
$db->Execute('SET time_zone = "+8:00"');

after the line

Code:
$db->Execute('SET NAMES UTF8');

I hope that +8:00 is the correct time zone for you wink

Hope it helps!

cloudduster

Re: Need to fix time zone for JB site

This one worked! Thanks!

putypuruty wrote:

Sorry, I was a little bit hasty with my previous response.

The fix is actually pretty simple: open _config/config.php and add the following line

Code:
$db->Execute('SET time_zone = "+8:00"');

after the line

Code:
$db->Execute('SET NAMES UTF8');

I hope that +8:00 is the correct time zone for you wink

Hope it helps!