Cache the DateTimeZon objects
darcs-hash:20080724234619-533db-015a2751ade3b5b8befb8a735fe89acd4742c4b9.gz
This commit is contained in:
parent
213ecbf35d
commit
dd3ae36084
12
lib/util.php
12
lib/util.php
@ -941,9 +941,17 @@ function common_date_string($dt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function common_exact_date($dt) {
|
function common_exact_date($dt) {
|
||||||
|
static $_utc;
|
||||||
|
static $_siteTz;
|
||||||
|
|
||||||
|
if (!$_utc) {
|
||||||
|
$_utc = new DateTimeZone('UTC');
|
||||||
|
$_siteTz = new DateTimeZone(common_timezone());
|
||||||
|
}
|
||||||
|
|
||||||
$dateStr = date('d F Y H:i:s', strtotime($dt));
|
$dateStr = date('d F Y H:i:s', strtotime($dt));
|
||||||
$d = new DateTime($dateStr, new DateTimeZone('UTC'));
|
$d = new DateTime($dateStr, $_utc);
|
||||||
$d->setTimezone(new DateTimeZone(common_timezone()));
|
$d->setTimezone($_siteTz);
|
||||||
return $d->format(DATE_RFC850);
|
return $d->format(DATE_RFC850);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user