1 date.inc | date_now($timezone = NULL, $reset = FALSE) |
A date object for the current time.
Parameters
object $timezone: (optional) Optionally force time to a specific timezone, defaults to user timezone, if set, otherwise site timezone. Defaults to NULL.
bool $reset: (optional) Static cache reset.
Return value
BackdropDateTime: The current time as a date object.
File
- core/
includes/ date.inc, line 752 - Date API functions.
Code
function date_now($timezone = NULL, $reset = FALSE) {
$now = &backdrop_static(__FUNCTION__ . $timezone);
if (!isset($now) || $reset) {
$now = new BackdropDateTime('now', $timezone);
}
// Avoid unexpected manipulation of cached $now object
// by subsequent code execution
// @see https://drupal.org/node/2261395
$clone = clone $now;
return $clone;
}