Junior — Middle
In which time zone do you work?
sobes.tech AI
Answer from AI
In PHP, the default timezone is set in the php.ini configuration file via the date.timezone directive. It is generally recommended to explicitly set the timezone in the code for correct date and time handling, for example:
// Set timezone to Moscow time
date_default_timezone_set('Europe/Moscow');
// Get current date and time
echo date('Y-m-d H:i:s');
This helps avoid issues with incorrect times when working with dates, especially if the server is in a different timezone. In production environments, UTC is often used for storing time, and the local timezone is applied when displaying to the user.