本文整理汇总了PHP中DateInterval::CreateFromDateString方法的典型用法代码示例。如果您正苦于以下问题:PHP DateInterval::CreateFromDateString方法的具体用法?PHP DateInterval::CreateFromDateString怎么用?PHP DateInterval::CreateFromDateString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateInterval
的用法示例。
在下文中一共展示了DateInterval::CreateFromDateString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DateTime
if (isset($_POST['forwarderremarks'])) {
$op->setValue('forwarderremarks', $_POST['forwarderremarks']);
$op->setValue('fromdate', $_POST['leavefromadb']);
$op->setValue('todate', $_POST['leavetoadb']);
$op->setValue('leaveid', $_POST['Leave_ID']);
$op->saveLeaveEntry();
///save leave entry
$appliedid = $op->getOperatorID();
$op->deleteLeaveEntries();
//delete old leave entries
//add new entries because there may be change in dates
$from = new DateTime($_POST['leavefromadb']);
$to = new DateTime($_POST['leavetoadb']);
$to = $to->modify('+1 day');
///to include end day also
$noofdays = DateInterval::CreateFromDateString('1 Day');
$period = new DatePeriod($from, $noofdays, $to);
foreach ($period as $dt) {
//print_r($dt);
$op->setValue('datedb', $dt->format("Y-m-d"));
$op->setValue('attstatusid', 3);
$op->setValue('operatorid', $appliedid);
$op->saveAttendence();
}
} else {
if (isset($_POST['abs']) && $_POST['abs'] != '') {
//print_r($_POST);
$op->setValue('operatorid', $_POST['Operator_IDab']);
$op->setValue('datedb', $_POST['absentdatedb']);
$op->setValue('remarks', $_POST['remarks']);
$op->setValue('attstatusid', $_POST['Att_Status_IDab']);