-1

I installed a virtual machine with php, mysql, apache2.

Now when I write in the terminal : date I get : Thu Dec 06:55:25 EET 2016.

When I try to get the now date in php,

I write : error_log(print_r(new \DateTime('now'),true), 3, "/tmp/error.log"); And I get :

DateTime Object
(
  [date] => 2016-12-01 06:56:33
  [timezone_type] => 3
  [timezone] => Europe/Bucharest
)

But now the hour is : 17:06.

How can resolve this ? Please help me and sorry for my english.

Harea Costicla
  • 797
  • 3
  • 9
  • 20

1 Answers1

-1
  • Make sure that you're settng timezones in correct php.ini file

  • Make sure your system timings are correct first.

You can set default timezone in PHP like this:

  • Open your php.ini file

  • Add the following line of code to top of your php.ini file

    date.timezone = "Your Timezone Here"

  • Once you've saved the changes, restart your apache and php services.

  • You get it running right from now on.

See more about PHP Timezone

Hope this helps!

Community
  • 1
  • 1
Saumya Rastogi
  • 13,159
  • 5
  • 42
  • 45