Topic: Time zone issue

I am in Hong Kong but the server is located in USA, a 15 hours difference in time. The server is set USA local time. Is there anyway to config the FA to compensate on this time difference? Please advise.

Re: Time zone issue

Hello,

Currently FA have no mechanism to set user local time, although it is not very big issue as it is only displayed in page footer and on reports as a time of printing. If you want to use FA only from HongKong location you can simply put into config.php (eg after $power_url dfinition) the line:

putenv("TZ=Asia/HongKong");

Janusz

Re: Time zone issue

Thank you again for your solution!

Re: Time zone issue

This setting works just fine, but I have noted that while DD/MM/YYYY seems fine for the user, the initial log in screen displays as MM/DD/YYYY ... it switches once you log in to the correct format - a bug maybe?

Cheers,
Tony

Re: Time zone issue

No, merely a catch 22 behaviour. What came first, the egg or the hen? I guess you understand smile. You will have to be loged in before the internal behaviour is setup.

/Joe

6 (edited by metech 01/13/2011 06:09:17 pm)

Re: Time zone issue

I live in Melbourne Australia but use a server in North America.  I could have offices anywhere in the world and still use the same server.  It doesn't figure that North America automatically relates in any way to where my office is located.  So why should the time on my login be hard coded to my server?  It makes more sense that I should determine what time zone I choose, typically tying it to my main office if working in different time zones.  As it happens I only have the one office and the time difference is about 19 hours.  Makes it pretty hard when the date is a day out to keep track of things.  When I send invoices my clients think funny things about me when they check the date.  What makes it harder is that the only solution offered so far is to add putenv into the config.  My server has disabled this function for security reasons and I've actually had to modify FA where it uses it for language.

So I'm guessing that I'm not the only one who would like to change it to suit their circumstance so here's my solution.  In date_functions.inc I changed:
if(function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get"))
    @date_default_timezone_set(@date_default_timezone_get());
to:
if(function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get"))
    @date_default_timezone_set('Australia/Melbourne');

And guess what?  Problem solved for good.  Even before logging in.  I'm a novice at both programming and FA but I'm sure it wouldn't be hard to add a bit of functionality around this bit of code when using the setup options if someone who can do it competently agrees.

Cheers

Re: Time zone issue

tonyshaus wrote:

This setting works just fine, but I have noted that while DD/MM/YYYY seems fine for the user, the initial log in screen displays as MM/DD/YYYY ... it switches once you log in to the correct format - a bug maybe?

No. As Joe explained it is not a bug - just user date format is unknown before login. But you can select default date format used on login screen in config.php with $dflt_date_fmt variable.
Janusz

Re: Time zone issue

@metech
You can set any timezone you wish in your config.php file (this is only right place for such type of configuration settings). Look into config.default.php how it is done in case when no default timezone is set in php.ini file.

Janusz

Re: Time zone issue

Although it doesn't take much, instead of manually configuring it in config.php, it would be great if you can just add a table with all time zones and user can pick the default time zone for use. Just makes it that much easier for first time users.

Nevertheless, this is one hell of a package which is really good and flexible.

Cheers!
Raj

Re: Time zone issue

This was fairly easy by just going to your .htaccess file in your root folder and adding - php_value date.timezone "Europe/Berlin" according to the php timezone table here>>http://php.net/manual/en/timezones.php

11 (edited by aquarius 03/23/2014 06:55:23 am)

Re: Time zone issue

Can't get this time zone issue to work properly. I am located in/near Brisbane/Australia.

My config.php files show the time zone asf:

    if (!ini_get('date.timezone'))
       ini_set('date.timezone', 'Australia/Brisbane');

Yet the actual time zone displayed on the live site is UTC+1 or 'Europe/Berlin'

Frontaccounting is hosted in a subdirectory of my main site. The main site displays the correct time zone, both front and and admin.

What could be wrong?

Thanks / Frank

Edit:
-----

Fixed it by adding

date_default_timezone_set('Australia/Brisbane');

to includes/date.functions.inc

Now shows the proper time.

Re: Time zone issue

I would also be in favour of Raj's suggestion of adding a table with times zones where a user could pick her/his timezone. It would then make it unnecessary for a user to be forced to update the timezone in the config.php or php.ini or any other file. I suspect many users will not have easy access to those files nor have enough PHP knowledge to modify them.

IMO, best to do such changes inside the FrontAccounting setup.

Wonderful package. I have just installed it and will start using it soon.

Marc

Re: Time zone issue

TimeZone can be a SysPrefs variable that is company wide with a user table override. It is handled in FA using PHP's TimeZone functions and hence it should be easily obtained from http://php.net/manual/en/timezones.php on the fly.

Re: Time zone issue

I am a little confused with your message. Are you saying that it has already been implemented and that the time-zone can be changed in FA?

Otherwise, IMO, for most users, going into the config.php or anything else is just going to increase the frustration when they are at the very beginning of using FA. It would seem to make more sense to remove the item of frustration by adding the ability to change the time-zone inside FA setup.

Marc

Re: Time zone issue

That was a note to the devs for populating the drop down select box with TimeZone entries directly from the php function. Probably will make it to FA v2.4 in time.

Re: Time zone issue

That is wonderful news! Thanks!

Marc