- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/db/sqlhelper.php
- Класс: BitrixMainDBSqlHelper
- Вызов: SqlHelper::getDatetimeToDateFunction
public function getDatetimeToDateFunction($value); /** * Returns database expression for converting $field value according the $format. ** Following format parts converted: * - YYYY A full numeric representation of a year, 4 digits * - MMMM A full textual representation of a month, such as January or March * - MM Numeric representation of a month, with leading zeros * - MI Minutes with leading zeros * - M A short textual representation of a month, three letters * - DD Day of the month, 2 digits with leading zeros * - HH 24-hour format of an hour with leading zeros * - H 24-hour format of an hour without leading zeros * - GG 12-hour format of an hour with leading zeros * - G 12-hour format of an hour without leading zeros * - SS Seconds with leading zeros * - TT AM or PM * - T AM or PM *
* $field parameter is SQL unsafe. * * @param string $format Format string. * @param string $field Database field or expression. * * @return string */ abstract public function formatDate($format, $field = null); /** * Returns function for getting part of string. *
* If length is null or omitted, the substring starting * from start until the end of the string will be returned. *
* $str and $from parameters are SQL unsafe. * * @param string $str Database field or expression. * @param integer $from Start position. * @param integer $length Maximum length. * * @return string */ public function getSubstrFunction($str, $from, $length = null) { $sql = 'SUBSTR('.$str.', '.$from; if (!is_null($length)) $sql .= ', '.$length; return $sql.')'; }