本文整理汇总了PHP中DateTimeValue::setMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeValue::setMonth方法的具体用法?PHP DateTimeValue::setMonth怎么用?PHP DateTimeValue::setMonth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeValue
的用法示例。
在下文中一共展示了DateTimeValue::setMonth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
}
}
示例2: getEventLimits
function getEventLimits($event, $date, &$event_start, &$event_duration, &$end_modified)
{
$end_modified = false;
$event_start = new DateTimeValue($event->getStart()->getTimestamp() + 3600 * logged_user()->getTimezone());
$event_duration = new DateTimeValue($event->getDuration()->getTimestamp() + 3600 * logged_user()->getTimezone());
$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());
}
}
}