added time zone setting to server profile

This commit is contained in:
Roland Gruber 2015-06-08 19:03:57 +00:00
parent 5930ef17b5
commit 75b59ce12d
1 changed files with 14 additions and 2 deletions

View File

@ -917,8 +917,10 @@ function compareDN(&$a, &$b) {
* @return String formated time * @return String formated time
*/ */
function formatLDAPTimestamp($time) { function formatLDAPTimestamp($time) {
return substr($time, 6, 2) . '.' . substr($time, 4, 2) . '.' . substr($time, 0, 4) . $timeNumbers = substr($time, 0, -1);
' ' . substr($time, 8, 2) . ':' . substr($time, 10, 2) . ':' . substr($time, 12, 2) . ' GMT'; $dateTime = DateTime::createFromFormat('YmdHis', $timeNumbers, new DateTimeZone('UTC'));
$dateTime->setTimezone(getTimeZone());
return $dateTime->format('d.m.Y H:i:s');
} }
/** /**
@ -1267,4 +1269,14 @@ function getTimeZoneOffsetHours() {
return round($dtz->getOffset(new DateTime('UTC')) / 3600); return round($dtz->getOffset(new DateTime('UTC')) / 3600);
} }
/**
* Returns the configured time zone.
*
* @return DateTimeZone time zone
*/
function getTimeZone() {
$timeZone = $_SESSION['config']->getTimeZone();
return new DateTimeZone($timeZone);
}
?> ?>