1

I'm using PHP 7.4.24 on docker env. In php ini I specified only time zone:

[Date]
date.timezone = Japan

Even if you specify the time zone inside the script it doesn't matter

$date = new \DateTime('now', new DateTimeZone('Japan'));
echo $date->format('d.m.Y H:i:s');

It says: 10.11.2021 14:14:17, but real time for that timezone for now is 10.11.2021 17:34:17 My biggest issue is that the time difference is 20 minutes, so I can't pick other timezone to make it work correct.

Hevyweb
  • 402
  • 1
  • 5
  • 18

1 Answers1

0

I found an answer in this question How to make sure docker's time syncs with that of the host? I ran this in console and it helped

docker run --rm --privileged alpine hwclock -s
Hevyweb
  • 402
  • 1
  • 5
  • 18