5 Replies Latest reply on Aug 1, 2009 9:28 PM by Ian A.

    System's timezone settings problem?

    Ian A.

      Hello All,


      I thought I was having problems with Session variables, but it seems it is something different.


      I am doing testing on a website on a localhost - a PC set up with Australian timezone, and everything works fine, however when uploaded to an American server located in Denver, I get this as an error:

      Strict Standards: date() [function.date0]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MDT/-6.0/DST' instead in .../includes/common/KT_functions.inc.php on line 678

      and the site does not work as I anticipated.


      However, I can utilize a server located in Australia, and when uploaded to that, it works as expected.  But to use the Australian server costs more for the bandwidth, and I would prefer to use the US server.


      The question is, what can I do to fix the problem, can it be fixed by altering any of the ADDT files??  Or does the server have to be altered?


      Thanks in advance for any help anyone can give me.





        • 1. Re: System's timezone settings problem?
          DwFAQ Level 4

          With local Apache server you can change the timezone in .htaccess file to Denver timezone. That may help...

          • 2. Re: System's timezone settings problem?
            Ian A. Level 1

            Thank you www.DwFAQ.info, I had google the problem too, and came across pretty much what you stated.


            But I have put the function "date_default_timezone_set('America/Denver');" at the start of each page.


            So, I can actually put it in the .htaccess file and it is obviously a site wide declaration?


            Is the syntax the same in the .htaccess file, do I put in the exact same text as I have done with the PHP code?


            Will try now and see what I come up with.



            Thanks for your help




            • 3. Re: System's timezone settings problem?
              Ian A. Level 1

              Hi All,


              I have tried this: "SetEnv TZ Australia/Melbourne" in the .htaccess file, and it does not seem to work.


              However, this does, at the top of each page: <?php date_default_timezone_set('Australia/Melbourne'); ?>


              So, for the moment, I will leave with the function at the top of the page, I will get around to putting it into another file and calling it via an include_once(), that way I can put it in one location and only have to change one file, if I ever have the need too.


              That way, I can comment out the timezone if I need to while testing, but I suppose that is not warranted, if testing on a localhost machine?





              • 4. Re: System's timezone settings problem?
                DwFAQ Level 4
                I have tried this: "SetEnv TZ Australia/Melbourne" in the .htaccess file, and it does not seem to work.



                I said to put Denver timezone in .htaccess, not Australia

                • 5. Re: System's timezone settings problem?
                  Ian A. Level 1

                  I have tried many of the applicable timezones according to: http://us3.php.net/manual/en/timezones.php, to put into the .htaccess file, and none of them seem to work, and I still obtain errors from using an MXI include file if any timezone is set with: SetEnv TZ timezone.


                  However, what seems to work is setting the default timezone I wish to use at the top of the page: date_default_timezone_set('Australia/Melbourne'); and any timezone works, and I can obtain a time specific to that timezone I set. So, that works.


                  If I have all the errors flagged by setting them in the .htaccess, other errors are shown, other tNG_log::log() errors pop up at different line numbers:

                  Strict Standards:  Non-static method tNG_log::log() should not be called statically, assuming $this from incompatible context in .../includes/tng/tNG.class.php on line 179

                  Strict Standards:  Non-static method tNG::compareTriggers() cannot be called statically, assuming $this from compatible context tNG_insert in .../includes/tng/tNG.class.php on line 212


                  But, the page still seems to work as expected when the errors are disabled.  From what I gather talking to the person running the web server, it is the way the PHP is set up, and from what I can gather by my own research, the errors are nitpicky, and enforce a strict standard, as it states in the error.


                  Having said all that, what works is setting the timezone at the start of the page, before any scripts run, so the default timezone has been set prior to calling any date/time functions.  And the pages work as expected.  So, I don't know how / why, but I am happy things are working thus far.


                  Thank you for your help,