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


PHP DateTime::createFromPhp方法代码示例

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


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

示例1: modifyToDb

 protected static function modifyToDb($data)
 {
     $result = array();
     foreach ($data as $name => $value) {
         if ($name == 'date' && $value instanceof \DateTime) {
             $value = DateTime::createFromPhp($value);
         }
         if (in_array($name, array('originalData', 'updateData'))) {
             $value = \WS\Migrations\arrayToJson($value);
         }
         $result[$name] = $value;
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:14,代码来源:appliedchangeslogmodel.php

示例2: checkPeriod

 /**
  * @return string
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function checkPeriod($isAgentExec = true)
 {
     $isAgentExecInSetting = \COption::GetOptionString("sender", "reiterate_method") !== 'cron';
     if ($isAgentExec && !$isAgentExecInSetting || !$isAgentExec && $isAgentExecInSetting) {
         return "";
     }
     $dateTodayPhp = new \DateTime();
     $datetimeToday = Type\DateTime::createFromPhp(clone $dateTodayPhp);
     $dateToday = clone $dateTodayPhp;
     $dateToday = Type\Date::createFromPhp($dateToday->setTime(0, 0, 0));
     $dateTomorrow = clone $dateTodayPhp;
     $dateTomorrow = Type\Date::createFromPhp($dateTomorrow->setTime(0, 0, 0))->add('1 DAY');
     $arDateFilter = array($dateToday, $dateTomorrow);
     $chainDb = MailingChainTable::getList(array('select' => array('ID', 'LAST_EXECUTED', 'POSTING_ID', 'DAYS_OF_MONTH', 'DAYS_OF_WEEK', 'TIMES_OF_DAY'), 'filter' => array('=REITERATE' => 'Y', '=MAILING.ACTIVE' => 'Y', 'STATUS' => MailingChainTable::STATUS_WAIT)));
     while ($arMailingChain = $chainDb->fetch()) {
         $lastExecuted = $arMailingChain['LAST_EXECUTED'];
         /* @var \Bitrix\Main\Type\DateTime $lastExecuted*/
         if ($lastExecuted && $lastExecuted->getTimestamp() >= $dateToday->getTimestamp()) {
             continue;
         }
         $timeOfExecute = static::getDateExecute($dateTodayPhp, $arMailingChain["DAYS_OF_MONTH"], $arMailingChain["DAYS_OF_WEEK"], $arMailingChain["TIMES_OF_DAY"]);
         if ($timeOfExecute) {
             $arUpdateMailChain = array('LAST_EXECUTED' => $datetimeToday);
             $postingDb = PostingTable::getList(array('select' => array('ID'), 'filter' => array('=MAILING_CHAIN_ID' => $arMailingChain['ID'], '><DATE_CREATE' => $arDateFilter)));
             $arPosting = $postingDb->fetch();
             if (!$arPosting) {
                 $postingId = MailingChainTable::initPosting($arMailingChain['ID']);
             } else {
                 $postingId = $arPosting['ID'];
                 $arUpdateMailChain['POSTING_ID'] = $postingId;
                 PostingTable::initGroupRecipients($postingId);
             }
             if ($postingId) {
                 $arUpdateMailChain['STATUS'] = MailingChainTable::STATUS_SEND;
                 $arUpdateMailChain['AUTO_SEND_TIME'] = Type\DateTime::createFromPhp($timeOfExecute);
             }
             MailingChainTable::update(array('ID' => $arMailingChain['ID']), $arUpdateMailChain);
         }
     }
     return static::getAgentNamePeriod();
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:45,代码来源:mailingmanager.php

示例3: modifyToDb

 protected static function modifyToDb($data)
 {
     $data['date'] && $data['date'] instanceof \DateTime && ($data['date'] = DateTime::createFromPhp($data['date']));
     return $data;
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:5,代码来源:setuplogmodel.php


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