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


PHP DateTimeValue::setMinute方法代码示例

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


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

示例1: getEventLimits

function getEventLimits($event, $date, &$event_start, &$event_duration, &$end_modified)
{
    $end_modified = false;
    if ($event instanceof ProjectEvent) {
        $event_start = new DateTimeValue($event->getStart()->getTimestamp() + 3600 * logged_user()->getTimezone());
        $event_duration = new DateTimeValue($event->getDuration()->getTimestamp() + 3600 * logged_user()->getTimezone());
    } else {
        if ($event instanceof ProjectTask) {
            /* @var $event ProjectTask */
            $work_day_start = new DateTimeValue($date->getTimestamp());
            $wsd = user_config_option('work_day_start_time');
            $work_day_start->setHour(substr($wsd, 0, strpos($wsd, ':')));
            $work_day_start->setMinute(substr($wsd, strpos($wsd, ':') + 1));
            if ($event->getStartDate() instanceof DateTimeValue) {
                $event_start = new DateTimeValue($event->getStartDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
            } else {
                if ($event->getTimeEstimate() > 0 && $event->getDueDate() instanceof DateTimeValue) {
                    $event_start = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
                    $event_start->advance($event->getTimeEstimate() * -60);
                } else {
                    $event_start = $work_day_start;
                }
            }
            $work_day_end = new DateTimeValue($date->getTimestamp());
            $wed = user_config_option('work_day_end_time');
            $work_day_end->setHour(substr($wed, 0, strpos($wed, ':')));
            $work_day_end->setMinute(substr($wed, strpos($wed, ':') + 1));
            if ($event->getDueDate() instanceof DateTimeValue) {
                $event_duration = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
            } else {
                if ($event->getTimeEstimate() > 0 && $event->getStartDate() instanceof DateTimeValue) {
                    $event_duration = new DateTimeValue($event_start->getTimestamp());
                    $event_duration->advance($event->getTimeEstimate() * 60);
                } else {
                    $event_duration = $work_day_end;
                }
            }
        }
    }
    $tomorrow = new DateTimeValue($date->getTimestamp());
    $tomorrow->add('d', 1);
    if ($event_duration->getTimestamp() > $tomorrow->getTimestamp()) {
        $event_duration = new DateTimeValue($tomorrow->getTimestamp());
        $end_modified = true;
    }
    if ($event_start->getTimestamp() < $date->getTimestamp()) {
        if (!$event->isRepetitive()) {
            $event_start = new DateTimeValue($date->getTimestamp());
        } else {
            $event_start->setDay($date->getDay());
            $event_start->setMonth($date->getMonth());
            $event_start->setYear($date->getYear());
        }
    }
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:55,代码来源:calendar.php


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