drupal_get_user_timezone()
Returns the time zone of the current user.
File
- core/includes/bootstrap.inc, line 516
- Functions that need to be loaded on every Drupal request.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function drupal_get_user_timezone() { $user = \Drupal::currentUser(); $config = \Drupal::config( 'system.date' ); if ( $user && $config ->get( 'timezone.user.configurable' ) && $user ->isAuthenticated() && $user ->getTimezone()) { return $user ->getTimezone(); } else { // Ignore PHP strict notice if time zone has not yet been set in the php.ini // configuration. $config_data_default_timezone = $config ->get( 'timezone.default' ); return ! empty ( $config_data_default_timezone ) ? $config_data_default_timezone : @date_default_timezone_get(); } } |
Please login to continue.