From 89421417fe54ec471792dbb2abd65c8b3d4737ea Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 1 Nov 2015 10:20:39 +0000 Subject: [PATCH] support Windows timestamps --- lam/lib/account.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 6a97a936..dae50cdd 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -917,7 +917,14 @@ function compareDN(&$a, &$b) { * @return String formated time */ function formatLDAPTimestamp($time) { + // Windows format: 20140118093807.0Z + // OpenLDAP format: 20140118093807Z + // cut off "Z" $timeNumbers = substr($time, 0, -1); + // for Windows cut off ".0" + if (strpos($timeNumbers, '.') == (strlen($timeNumbers) - 2)) { + $timeNumbers = substr($timeNumbers, 0, -2); + } $dateTime = DateTime::createFromFormat('YmdHis', $timeNumbers, new DateTimeZone('UTC')); $dateTime->setTimezone(getTimeZone()); return $dateTime->format('d.m.Y H:i:s');