• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/db/pgsqlsqlhelper.php
  • Класс: BitrixMainDBPgsqlSqlHelper
  • Вызов: PgsqlSqlHelper::formatDate
public function formatDate($format, $field = null)
{
	static $search  = array(
		"MMMM",
		"HH",
		"GG",
		"G",
		"TT",
		"T"
	);
	static $replace = array(
		"FMMonth",
		"HH24",
		"HH12",
		"FMHH12",
		"PM",
		"PM"
	);

	$format = str_replace($search, $replace, $format);

	if ($field === null)
	{
		return $format;
	}
	else
	{
		return "to_char(".$field.", '".$format."')";
	}
}