Core date and time related code.  
 More...
 | 
| 
static  | init_zones () | 
|   | Initialise timezone arrays, call before use. 
  | 
|   | 
 | 
| 
static array  | $badzones = null | 
|   | mapping of timezones not supported by PHP 
  | 
|   | 
| 
static array  | $bczones = null | 
|   | list of BC zones supported by PHP 
  | 
|   | 
| 
static string  | $defaultphptimezone = null | 
|   | the default PHP timezone right after config.php 
  | 
|   | 
| 
static array  | $goodzones = null | 
|   | list of recommended zones 
  | 
|   | 
Core date and time related code. 
- Since
 - Moodle 2.9
 
- Copyright
 - 2015 Totara Learning Solutions Ltd  
 
- License
 - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
 
- Author
 - Petr Skoda petr..nosp@m.skod.nosp@m.a@tot.nosp@m.aral.nosp@m.ms.co.nosp@m.m 
 
 
◆ get_default_php_timezone()
  
  
      
        
          | static core_date::get_default_php_timezone  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Return default timezone set in php.ini or config.php. 
- Return values
 - 
  
    | string | normalised timezone compatible with PHP  | 
  
   
 
 
◆ get_list_of_timezones()
  
  
      
        
          | static core_date::get_list_of_timezones  | 
          ( | 
            | 
          $currentvalue = null,  | 
         
        
           | 
           | 
            | 
          $include99 = false  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Returns a localised list of timezones. 
- Parameters
 - 
  
    | string | $currentvalue |  | 
    | bool | $include99 | should the server timezone info be included?  | 
  
   
- Return values
 - 
  
  
 
 
 
◆ get_localised_timezone()
  
  
      
        
          | static core_date::get_localised_timezone  | 
          ( | 
            | 
          $tz | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns localised timezone name. 
- Parameters
 - 
  
  
 
- Return values
 - 
  
  
 
 
 
◆ get_server_timezone()
  
  
      
        
          | static core_date::get_server_timezone  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns server timezone. 
- Return values
 - 
  
    | string | normalised timezone name compatible with PHP  | 
  
   
 
 
◆ get_server_timezone_object()
  
  
      
        
          | static core_date::get_server_timezone_object  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns server timezone. 
- Return values
 - 
  
  
 
 
 
◆ get_user_timezone()
  
  
      
        
          | static core_date::get_user_timezone  | 
          ( | 
            | 
          $userorforcedtz = null | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns user timezone. 
Ideally the parameter should be a real user record, unfortunately the legacy code is using 99 for both server and default value.
Example of using legacy API: // Date for other user via legacy API. $datestr = userdate($time, core_date::get_user_timezone($user));
The coding style rules in Moodle are moronic, why cannot the parameter names have underscores in them?
- Parameters
 - 
  
    | mixed | $userorforcedtz | user object or legacy forced timezone string or tz object  | 
  
   
- Return values
 - 
  
    | string | normalised timezone name compatible with PHP  | 
  
   
 
 
◆ get_user_timezone_object()
  
  
      
        
          | static core_date::get_user_timezone_object  | 
          ( | 
            | 
          $userorforcedtz = null | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Return user timezone object. 
- Parameters
 - 
  
  
 
- Return values
 - 
  
  
 
 
 
◆ normalise_timezone()
  
  
      
        
          | static core_date::normalise_timezone  | 
          ( | 
            | 
          $tz | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Normalise the timezone name. 
If timezone not supported this method falls back to server timezone (if valid) or default PHP timezone.
- Parameters
 - 
  
    | int | string | float | DateTimeZone | $tz |  | 
  
   
- Return values
 - 
  
    | string | timezone compatible with PHP  | 
  
   
 
 
◆ phpunit_override_default_php_timezone()
  
  
      
        
          | static core_date::phpunit_override_default_php_timezone  | 
          ( | 
            | 
          $tz | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Do not use directly - use $this->setTimezone('xx', $tz) instead in your test case. 
- Parameters
 - 
  
    | string | $tz | valid timezone name  | 
  
   
 
 
The documentation for this class was generated from the following file: