ddev

How can I set the timezone in my ddev containers?


I often use ddev ssh (for web/nginx container) or ddev ssh -s db (for the db/mariadb container), and when looking at logs and such I'd like to see date/timestamps in my own timezone so I don't have to think so hard about how many hours it is from GMT. I can't use dpkg-reconfigure tzdata in the container because the container user doesn't have root privileges.


Solution

  • Edit 2025-01-03: In recent versions of DDEV, the timezone is inferred from the host-side timezone automatically for most situations, but setting the timezone as below is still a valid approach. See docs.

    Configure this in the .ddev/config.yaml: timezone: Europe/London, for example, or ddev config --timezone=Europe/London This configures both the container's timezone and php's default timezone.**

    See https://ddev.readthedocs.io/en/stable/users/configuration/config/#timezone