本文整理汇总了PHP中w2p_Utilities_Date::addSeconds方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Utilities_Date::addSeconds方法的具体用法?PHP w2p_Utilities_Date::addSeconds怎么用?PHP w2p_Utilities_Date::addSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Utilities_Date
的用法示例。
在下文中一共展示了w2p_Utilities_Date::addSeconds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clash_suggest
function clash_suggest(w2p_Core_CAppUI $AppUI, $cal_sdf)
{
global $m, $a;
$obj = new CEvent();
$obj->bind($_SESSION['add_event_post']);
$start_date = new w2p_Utilities_Date($obj->event_start_date);
$end_date = new w2p_Utilities_Date($obj->event_end_date);
$df = $AppUI->getPref('SHDATEFORMAT');
$start_secs = $start_date->getTime();
$end_secs = $end_date->getTime();
$duration = (int) (($end_secs - $start_secs) / 60);
$titleBlock = new w2p_Theme_TitleBlock('Suggest Alternative Event Time', 'myevo-appointments.png', $m, $m . '.' . $a);
$titleBlock->show();
$calurl = W2P_BASE_URL . '/index.php?m=calendar&a=clash&event_id=' . $obj->event_id;
$times = array();
$t = new w2p_Utilities_Date();
$t->setTime(0, 0, 0);
if (!defined('LOCALE_TIME_FORMAT')) {
define('LOCALE_TIME_FORMAT', '%I:%M %p');
}
for ($m = 0; $m < 60; $m++) {
$times[$t->format('%H%M%S')] = $t->format(LOCALE_TIME_FORMAT);
$t->addSeconds(1800);
}
/* TODO: This needs to be refactored to use the core setDate_new function. */
?>
<script language="javascript" type="text/javascript">
function setDate( frm_name, f_date ) {
fld_date = eval( 'document.' + frm_name + '.' + f_date );
fld_real_date = eval( 'document.' + frm_name + '.' + 'event_' + f_date );
if (fld_date.value.length>0) {
if ((parseDate(fld_date.value))==null) {
alert('The Date/Time you typed does not match your prefered format, please retype.');
fld_real_date.value = '';
fld_date.style.backgroundColor = 'red';
} else {
fld_real_date.value = formatDate(parseDate(fld_date.value), 'yyyyMMdd');
fld_date.value = formatDate(parseDate(fld_date.value), '<?php
echo $cal_sdf;
?>
');
fld_date.style.backgroundColor = '';
}
} else {
fld_real_date.value = '';
}
}
function set_clash_action(action) {
document.editFrm.clash_action.value = action;
document.editFrm.submit();
}
</script>
<form name="editFrm" method="post" action="<?php
echo $calurl . '&clash_action=process';
?>
" accept-charset="utf-8">
<table width='100%' class='std addedit'>
<tr>
<td width='50%' align='right'><?php
echo $AppUI->_('Earliest Date');
?>
:</td>
<td width='50%' align='left' nowrap="nowrap">
<input type="hidden" name="event_start_date" id="event_start_date" value="<?php
echo $start_date ? $start_date->format(FMT_TIMESTAMP_DATE) : '';
?>
" />
<input type="text" name="start_date" id="start_date" onchange="setDate('editFrm', 'start_date');" value="<?php
echo $start_date ? $start_date->format($df) : '';
?>
" class="text" />
<a href="javascript: void(0);" onclick="return showCalendar('start_date', '<?php
echo $df;
?>
', 'editFrm', null, true)">
<img src="<?php
echo w2PfindImage('calendar.gif');
?>
" width="24" height="12" alt="<?php
echo $AppUI->_('Calendar');
?>
" border="0" />
</a>
</td>
</tr>
<tr>
<td width='50%' align='right'><?php
echo $AppUI->_('Latest Date');
?>
:</td>
<td width='50%' align='left' nowrap="nowrap">
<input type="hidden" name="event_end_date" id="event_end_date" value="<?php
echo $end_date ? $end_date->format(FMT_TIMESTAMP_DATE) : '';
?>
" />
<input type="text" name="end_date" id="end_date" onchange="setDate('editFrm', 'end_date');" value="<?php
echo $end_date ? $end_date->format($df) : '';
?>
//.........这里部分代码省略.........
示例2: getEndWeek
function getEndWeek($d)
{
$dn = (int) $d->Format('%w');
if ($dn > 0) {
$dn = 7 - $dn;
}
$dd = new w2p_Utilities_Date($d);
$dd->addSeconds($dn * 24 * 3600);
return (int) $dd->Format('%U');
}
示例3: submitIt
$seldate->convertTZ('UTC');
$obj->event_end_date = $seldate->format(FMT_TIMESTAMP);
}
}
$start_date = intval($obj->event_start_date) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($obj->event_start_date, '%Y-%m-%d %T')) : null;
$end_date = intval($obj->event_end_date) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($obj->event_end_date, '%Y-%m-%d %T')) : $start_date;
$recurs = array('Never', 'Hourly', 'Daily', 'Weekly', 'Bi-Weekly', 'Every Month', 'Quarterly', 'Every 6 months', 'Every Year');
$remind = array('900' => '15 mins', '1800' => '30 mins', '3600' => '1 hour', '7200' => '2 hours', '14400' => '4 hours', '28800' => '8 hours', '56600' => '16 hours', '86400' => '1 day', '172800' => '2 days');
// build array of times in 30 minute increments
$times = array();
$t = new w2p_Utilities_Date();
$t->setTime(0, 0, 0);
//$m clashes with global $m (module)
for ($minutes = 0; $minutes < 24 * 60 / $inc; $minutes++) {
$times[$t->format('%H%M%S')] = $t->format($AppUI->getPref('TIMEFORMAT'));
$t->addSeconds($inc * 60);
}
?>
<script language="javascript" type="text/javascript">
function submitIt(){
var form = document.editFrm;
if (form.event_name.value.length < 1) {
alert('<?php
echo $AppUI->_('Please enter a valid event title', UI_OUTPUT_JS);
?>
');
form.event_name.focus();
return;
}
if (form.event_start_date.value.length < 1){
alert('<?php
示例4: calcFinish
public function calcFinish($duration, $durationType)
{
// since one will alter the date ($this) one better copies it to a new instance
$finishDate = new w2p_Utilities_Date();
$finishDate->copy($this);
// get w2P time constants
$day_start_hour = intval(w2PgetConfig('cal_day_start'));
$day_end_hour = intval(w2PgetConfig('cal_day_end'));
$work_hours = intval(w2PgetConfig('daily_working_hours'));
$duration_in_minutes = $durationType == 24 ? $duration * $work_hours * 60 : $duration * 60;
// Jump to the first working day
while (!$finishDate->isWorkingDay()) {
$finishDate->addDays(1);
}
$first_day_minutes = min($day_end_hour * 60 - $finishDate->getHour() * 60 - $finishDate->getMinute(), $work_hours * 60, $duration_in_minutes);
$finishDate->addSeconds($first_day_minutes * 60);
$duration_in_minutes -= $first_day_minutes;
while ($duration_in_minutes != 0) {
// Jump to the next day
$finishDate->addDays(1);
// Reset date's time to the first hour in the morning
$finishDate->setTime($day_start_hour);
// Jump all non-working days
while (!$finishDate->isWorkingDay()) {
$finishDate->addDays(1);
}
$day_work_minutes = min($work_hours * 60, $duration_in_minutes);
$finishDate->addSeconds($day_work_minutes * 60);
$duration_in_minutes -= $day_work_minutes;
}
return $finishDate;
}
示例5: testAddSecondsAcrossYear
/**
* Tests adding seconds across a year
*/
public function testAddSecondsAcrossYear()
{
$date = new w2p_Utilities_Date('2010-12-31 23:59:00');
$date->addSeconds(65);
$this->assertEquals('2011-01-01 00:00:05', $date->getDate(DATE_FORMAT_ISO));
}