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');