The Date class provides some functions to work with dates.
This method set the default timezone.
Static | Yes | |||
Parameters | Parameter | Type | Default | Description |
$timezone | String | String with the server timezone. |
Date::set_default_timezone('Europe/Berlin');
This method returns the default timezone.
Static | Yes | |||
Parameters | Parameter | Type | Default | Description |
var_dump(Date::get_default_timezone());
//Output : string(13) "Europe/Berlin"
This method return the number of days for given month in the specified year.
Static | Yes | |||
Parameters | Parameter | Type | Default | Description |
$month | integer | Required | The month to use for this method. | |
$year | integer | null | The year to use for this method. If no year is given, the current year will be used. |
var_dump(Date::days_in_month(2, 2012));
// Output: (int) 29