0
<?php
 $data = date("d-m-Y");
 echo $data; echo "<br>";

 $time = date('H:i:s', time());
 echo $time;
?>

I have a little problem: - between 00:00:00 and 01:00:00 (for 1 hour) the server day return yesterday, but the time is correct; - between 01 and 00 (for 23 hours) the date (day) is correct, but the time is time-1 hour.

What is wrong? How can I fix this? Thank you

PS. Please, excuse my bad English.

colombo2003
  • 121
  • 9
  • 1
    Sounds like the timezone on the server and where you are, are set to different. – Qirel Jan 19 '17 at 23:41
  • Strange... because the server is in the same country and city with me... – colombo2003 Jan 20 '17 at 00:15
  • Well, the setting sounds different. It's a default value, not based on location. Put [`date_default_timezone_set()`](http://php.net/manual/en/function.date-default-timezone-set.php) at the top. There's a **[list](http://php.net/manual/en/timezones.php)** of valid timezones. – Qirel Jan 20 '17 at 00:33

0 Answers0