Bitrix Site Manager

CDatabase::DateToCharFunction

string
CDatabase::DateToCharFunction(
 string value,
 string type = "FULL",
 string site = false
 )

The method DateToCharFunction returns the string DATE_FORMAT for MySQL or TO_CHAR for Oracle, with all the required parameters.

The date format is specified in either language or site preferences.

Parameters

ParameterDescription
value Date in the format of a current site.
type Type of the date format: "FULL" - date and time, "SHORT" - date only.
Optional; "FULL" by default.
site Site ID for the public section or language ID for administrative section.
Optional; the current ID is used by default.

See Also

Example



<?
$strSql = "
    SELECT 
        ID,    
        ".$DB->DateToCharFunction("DATE_CREATE")."    DATE_CREATE
    FROM 
        my_table
    ";
$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
?>