Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7947e4e authored by theronakpatel's avatar theronakpatel
Browse files

createTimestamp mysql

parent 22b33994
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -195,13 +195,14 @@ class SyncMissingUsersToCommon extends Command {
		// Get user metadata from LDAP
		$userMetadata = $this->ldapConnectionService->getUserMetadata($username);

		// Convert LDAP createTimestamp to ISO 8601 (Y-m-d\TH:i:s\Z)
		// Convert LDAP createTimestamp to MySQL datetime format
		$ldapTimestamp = $userMetadata['createTimestamp'] ?? null;
		$createdAt = $ldapTimestamp;

		if ($ldapTimestamp) {
			$dateTime = \DateTime::createFromFormat('YmdHis\Z', $ldapTimestamp, new \DateTimeZone('UTC'));
			if ($dateTime !== false) {
				$createdAt = $dateTime->format('c'); // ISO 8601
				$createdAt = $dateTime->format('Y-m-d H:i:s'); // Format compatible with MySQL
			}
		}