parse date ldap

This commit is contained in:
Jephté Clain 2024-10-25 20:29:54 +04:00
parent 0f3183c496
commit a059f0cb42
1 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,7 @@
<?php
namespace nur\ldap\syntaxes;
use DateTimeImmutable;
use nur\b\date\Datetime;
use nur\data\types\SDatetimeType;
@ -21,6 +22,11 @@ class DateSyntax extends AbstractSyntax {
}
function ldap2php(string $value) {
$d = DateTimeImmutable::createFromFormat("YmdHisT", $value);
$value = $d->format("d/m/Y H:i:s");
$value = preg_replace('/ 00:00:00$/', "", $value);
return $value;
/*
[$y, $m, $d, $H, $M, $S] = [
substr($value, 0, 4),
substr($value, 4, 2),
@ -32,5 +38,6 @@ class DateSyntax extends AbstractSyntax {
$datetime = new Datetime(gmmktime($H, $M, $S, $m, $d, $y));
$value = preg_replace('/ 00:00:00$/', "", $datetime->format());
return $value;
*/
}
}