当前位置: 首页>>代码示例>>PHP>>正文


PHP CDatabase::CharToDateFunction方法代码示例

本文整理汇总了PHP中CDatabase::CharToDateFunction方法的典型用法代码示例。如果您正苦于以下问题:PHP CDatabase::CharToDateFunction方法的具体用法?PHP CDatabase::CharToDateFunction怎么用?PHP CDatabase::CharToDateFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDatabase的用法示例。


在下文中一共展示了CDatabase::CharToDateFunction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

$arSelect = array("ID", "IBLOCK_ID", "*");
$property_enums = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => 2, "XML_ID" => "FOR_USERS"));
while ($enum_fields = $property_enums->GetNext()) {
    $enums_id[] = $enum_fields["ID"];
}
if (empty($_GET["filter"])) {
    if (date("U", strtotime($start_date)) < date("U", strtotime(date("j.n.Y", time())))) {
        $start_date = date("j.n.Y", strtotime(date("j.n.Y", time()) . " Monday"));
    }
    $arFilter = array("IBLOCK_ID" => 2, array("LOGIC" => "OR", array("IBLOCK_ID" => 2, "PROPERTY_ANC_ID" => $myID)), array("LOGIC" => "AND", array(">=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'")), array("<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'"))));
} elseif (substr($_GET["filter"], 0, 4) == "next") {
    $arFilter = array("IBLOCK_ID" => 2, ">=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'"), "<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'"));
} elseif (substr($_GET["filter"], 0, 4) == "prev") {
    $arFilter = array("IBLOCK_ID" => 2, "<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'"));
    if (!empty($_GET["s"])) {
        $arFilter[">=PROPERTY_START_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'");
    }
}
if (!empty($_GET["place"]) && empty($_GET["s"])) {
    $arFilter = array();
    $arFilter["IBLOCK_ID"] = 2;
    $arFilter["PROPERTY_CITY"] = $_GET["place"];
    if (empty($_GET["filter"])) {
        $arFilter["PROPERTY_ANC_ID"] = $myID;
    }
}
if ($_GET["q"]) {
    $arFilter["%NAME"] = $_GET["q"];
}
$res = CIBlockElement::GetList(array("PROPERTY_START_DATE" => "DESC"), $arFilter, false, false, $arSelect);
$numPeriod = 0;
开发者ID:dayAlone,项目名称:MyQube,代码行数:31,代码来源:index.php

示例2: PrepareUpdateBind

 public function PrepareUpdateBind($strTableName, $arFields, $strFileDir, $lang, &$arBinds, $strTableAlias = "")
 {
     $arBinds = array();
     if ($strTableAlias != "") {
         $strTableAlias .= ".";
     }
     $strUpdate = "";
     $arColumns = $this->GetTableFields($strTableName);
     foreach ($arColumns as $strColumnName => $arColumnInfo) {
         $type = $arColumnInfo["TYPE"];
         if (isset($arFields[$strColumnName])) {
             $value = $arFields[$strColumnName];
             if ($value === false) {
                 $strUpdate .= ", {$strTableAlias}`" . $strColumnName . "` = NULL";
             } else {
                 switch ($type) {
                     case "int":
                         $value = intval($value);
                         break;
                     case "real":
                         $value = doubleval($value);
                         break;
                     case "datetime":
                     case "timestamp":
                         if (strlen($value) <= 0) {
                             $value = "NULL";
                         } else {
                             $value = CDatabase::CharToDateFunction($value, "FULL", $lang);
                         }
                         break;
                     case "date":
                         if (strlen($value) <= 0) {
                             $value = "NULL";
                         } else {
                             $value = CDatabase::CharToDateFunction($value, "SHORT", $lang);
                         }
                         break;
                     default:
                         $value = "'" . $this->ForSql($value) . "'";
                 }
                 $strUpdate .= ", {$strTableAlias}`" . $strColumnName . "` = " . $value;
             }
         } elseif (is_set($arFields, "~" . $strColumnName)) {
             $strUpdate .= ", {$strTableAlias}`" . $strColumnName . "` = " . $arFields["~" . $strColumnName];
         }
     }
     if ($strUpdate != "") {
         $strUpdate = substr($strUpdate, 2);
     }
     return $strUpdate;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:51,代码来源:database.php

示例3: isset

CModule::IncludeModule("iblock");
$group_id = isset($arGroup["id"]) ? $arGroup["id"] : $_GET["GROUP_ID"];
$iblock_id = 2;
$arPosts = array();
// Постраничная пагинация / Сессия прописывается в init.php
if (($nPageSize = $_GET["page"]) && !$_GET["PAGEN_1"]) {
    $nPageSizePhoto = $nPageSize * 9;
} else {
    $nPageSizePhoto = 9;
}
$arFilter = array("IBLOCK_ID" => $iblock_id, "ACTIVE_DATE" => "Y", "PROPERTY_SOCIAL_GROUP_ID" => $group_id, "PROPERTY_ANC_TYPE" => 26, "PROPERTY_CREATED_USER_ID" => false);
if ($_GET["filter"] == "next" || empty($_GET["filter"])) {
    $arFilter[">=PROPERTY_START_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(time(), 'FULL')), "\\'");
}
if ($_GET["filter"] == "prev") {
    $arFilter["<PROPERTY_END_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(time(), 'FULL')), "\\'");
}
if ($_GET["filter"] == "my") {
    $arFilter["PROPERTY_ANC_ID"] = $USER->GetID();
}
if ($_GET["q"]) {
    $arFilter["%NAME"] = $_GET["q"];
}
$res = CIBlockElement::GetList(array("ACTIVE_FROM" => "DESC"), $arFilter, false, array("nPageSize" => $nPageSizePhoto));
while ($arItemObj = $res->GetNextElement()) {
    $arItem = $arItemObj->GetFields();
    $arItem["PROPERTIES"] = $arItemObj->GetProperties();
    $arPosts[$arItem["ID"]] = $arItem;
    /*if($USER->GetID() == 2) {
    		echo '<pre>'; print_r($arItem["PROPERTIES"]["START_DATE"]["VALUE"].' '.trim(CDatabase::CharToDateFunction(ConvertTimeStamp(time(),'FULL')),"\'")); echo '<pre>';
    		}*/
开发者ID:dayAlone,项目名称:MyQube,代码行数:31,代码来源:ajax_events.php


注:本文中的CDatabase::CharToDateFunction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。