Apache time stamp incorrect

13,613

Solution 1

Try to change the timezone in the php.ini configuration file, and then restart the apache service. You should have php.ini somewhere inside your WAMP installation folder.

EDIT: You might have the php.ini file inside the folder:

/wamp/bin/php/phpX.X.X

where phpX.X.X is your php version.

Look for the "date.timezone" line and change it to something like this:

date.timezone = "America/Los_Angeles"

You can find the supported timezones here: http://www.php.net/manual/en/timezones.php

More technical information is available here: http://php.net/manual/en/datetime.configuration.php

The .htaccess file has a local range, normally to the folder and sub-folders where the file is created. Changing the php.ini file makes the changes global to your PHP installation.

Solution 2

In addition to editing the /wamp/bin/php/phpX.X.X/php.ini you would need to make the same changes on Apache side too. Which is on /wamp/bin/apache/ApacheX.X.X/bin/php.ini

Share:
13,613
Ank
Author by

Ank

Updated on June 17, 2022

Comments

  • Ank
    Ank almost 2 years

    I am using WAMP server running PHP. At a particular step I am trying to capture system time and add it to the database with the following query

    $strSQLInsert = "UPDATE  track SET  State = 'Repeat' , DateTime = '" . date("m/d/Y h:i:s a") .  "',  where AccID like '". $values['SampleID'] ;
    

    but the time stamp is way off than my system time. The date is okay. I googled and found out that I can update my .htaccess with this line

    SetEnv TZ America/Los_Angles
    

    But I couldn't find where htaccess is. How do I get the correct time stamp.

    • TimWolla
      TimWolla over 12 years
      What about fixing the problem and not the symptoms: The wrong time?
    • Ank
      Ank over 12 years
      No I haven't . Where do I create this file? Which folder. c:\wamp\??
    • Ank
      Ank over 12 years
      @TimWolla . I don't understand what you mean. My system time is correct. The time stamp displayed is incorrect.
  • Ank
    Ank over 12 years
    I edited php.ini as you said and then "Restarted all services" and it didn't help but "Stopping all services" and then "Starting all Services" helped.. Thanks..
  • kleopatra
    kleopatra over 8 years
    hmm ... this doesn't look like a solution, is it?
  • Ponytell
    Ponytell over 8 years
    No it's not, but the site suggests "Help us find a solution by researching the problem, then contribute the results of your research and anything additional you’ve tried as a partial answer."