public static function fdmMultipleTrimmedDateTime($value, $query, $dataRow, $columnAlias) { $result = array(); if (is_array($value)) { foreach ($value as $v) { if (!empty($v)) { try { //try new independent datetime format $v = new Bitrix\Main\Type\DateTime($v, \Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT); } catch (Main\ObjectException $e) { //try site format try { $v = new Bitrix\Main\Type\DateTime($v); } catch (Main\ObjectException $e) { //try short format $v = Bitrix\Main\Type\DateTime::createFromUserTime($v); } } $result[] = $v; } } } return $result; }
public static function ConvertToDB($arProperty, $value) { if (strlen($value["VALUE"]) > 0) { try { $time = Bitrix\Main\Type\DateTime::createFromUserTime($value['VALUE']); $value['VALUE'] = $time->format("Y-m-d H:i:s"); } catch (Bitrix\Main\ObjectException $e) { } } return $value; }