Documentation

CharToDateFunction

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

The method returns a value converted to the YYYY-MM-DD [HH:MI:SS] format. Returns TO_DATE string with required parameters for Oracle. The date formats are specified in the Local settings of site. Non-static method.

Parameters

ParameterDescription
value When the function is called within the public section of site, the value parameter is the date in the current site format. If the function is called within administrative section, the value parameter is the date in the current language format.
type Type of the date format: "FULL" - date and time, "SHORT" - date only.
Optional; "FULL" by default.
lang Language ID for administrative section.
Optional. Current ID is used by default. Unavailable in versions fr om 3.0.11 to 3.3.21.

See Also

Examples of use

<?
$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 = "
    SEL ECT 
        ID
    FR OM 
        my_table
    WH ERE 
        DATE_CREATE <= ".$DB->CharToDateFunction("10.01.2003 23:59:59")."
    ";
$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
?>


© «Bitrix24», 2001-2022
Up