本文整理汇总了PHP中TimeDate::merge_time_meridiem方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::merge_time_meridiem方法的具体用法?PHP TimeDate::merge_time_meridiem怎么用?PHP TimeDate::merge_time_meridiem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::merge_time_meridiem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$reason = $_POST['reason'];
$hour = $_POST['date_start_hours'];
$minutes = $_POST['date_start_minutes'];
$ampm = $_POST['date_start_meridiem'];
$time_format = $timedate->get_user_time_format();
//get the logged in users time settings
//Combine date and time dependant on users settings
$time_separator = ":";
if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
$time_separator = $match[1];
}
if (!empty($hour) && !empty($minutes)) {
$time_start = $hour . $time_separator . $minutes;
}
if (isset($ampm) && !empty($ampm)) {
$time_start = $timedate->merge_time_meridiem($time_start, $timedate->get_time_format(), $ampm);
}
if (isset($time_start) && strlen($date) == 10) {
$date_start = $date . ' ' . $time_start;
}
$call->retrieve($id);
$call->date_start = $date_start;
//set new the start date
$call->save();
//save the new start date
//get the duration of the call
$hours = $call->duration_hours;
$mins = $call->duration_minutes;
//get the new start date directly from the database to avoid sugar changing the format to users setting
$query = 'SELECT date_start FROM calls WHERE id="' . $id . '"';
$result = $call->db->getOne($query);
示例2: testMergeAmPm
/**
* test for merge_time_meridiem
* @dataProvider ampmDataSet
*/
public function testMergeAmPm($date, $mer, $tf, $display)
{
$amdate = $this->time_date->merge_time_meridiem($date, $tf, $mer);
$this->assertEquals($display, $amdate, "Bad min result for {$date} format {$tf}");
}