Bitrix Site Manager

CDatabase::CharToDateFunction

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

MySQL

The method CharToDateFunction returns a value converted to the format YYYY-MM-DD [HH:MI:SS].

Oracle

The method CharToDateFunction returns a string TO_DATE with the required parameters.

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

Parameters

ParameterDescription
value If the method is called within the public section, the value parameter is the date in the format of a current site.
If the method is called within the administrative section, the value parameter is the date in the format of a current language.
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



<?
$arr = getdate();
$ndate = mktime(9,0,0,$arr["mon"],$arr["mday"],$arr["year"]);
$next_exec = $DB->CharToDateFunction(GetTime($ndate,"FULL"));
CAgent::AddAgent("SendDailyStatistics();",
                 "statistic","Y",86400,"",
                 "Y",$next_exec, 25);
?>
<?
$strSql = "
    SELECT 
        ID
    FROM 
        my_table
    WHERE 
        DATE_CREATE <= ".$DB->CharToDateFunction("10.01.2003 23:59:59")."
    ";
$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
?>