223 of 410 menu

The date_default_timezone_set Function

The date_default_timezone_set function sets the default timezone for all date and time functions in the script. The timezone is specified by a string consisting of the continent name and the city name. For example, 'Europe/Moscow' is the timezone for Moscow, and 'Europe/Minsk' is the timezone for Minsk. You can find all possible timezone names here.

Syntax

date_default_timezone_set(string $timezone): bool

Example

Let's set the Moscow timezone for all date and time functions:

<?php date_default_timezone_set('Europe/Moscow'); ?>

See Also

byenru