本文整理汇总了PHP中period_time_string函数的典型用法代码示例。如果您正苦于以下问题:PHP period_time_string函数的具体用法?PHP period_time_string怎么用?PHP period_time_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了period_time_string函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preg_replace
} else {
$d[$day_num]['option_reser'][] = -1;
}
$d[$day_num]['moderation'][] = $row['11'];
$midnight_tonight = $midnight + 86400;
if (!isset($correct_heure_ete_hiver) || $correct_heure_ete_hiver == 1) {
if (heure_ete_hiver('hiver', $year_num, 0) == mktime(0, 0, 0, $month_num, $day_num, $year_num)) {
$midnight_tonight += 3600;
}
if (date('H', $midnight_tonight) == '01') {
$midnight_tonight -= 3600;
}
}
if ($enable_periods == 'y') {
$start_str = preg_replace('/ /', ' ', period_time_string($row['0']));
$end_str = preg_replace('/ /', ' ', period_time_string($row['1'], -1));
switch (cmp3($row['0'], $midnight) . cmp3($row['1'], $midnight_tonight)) {
case '> < ':
case '= < ':
if ($start_str == $end_str) {
$d[$day_num]['data'][] = $start_str;
} else {
$d[$day_num]['data'][] = $start_str . get_vocab('to') . $end_str;
}
break;
case '> = ':
$d[$day_num]['data'][] = $start_str . get_vocab('to') . '24:00';
break;
case '> > ':
$d[$day_num]['data'][] = $start_str . get_vocab('to') . '>';
break;
示例2: userdate
case "< < ":
# Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . userdate($row[1], hour_min_format());
break;
case "< = ":
# Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
# Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = ereg_replace(" ", " ", period_time_string($row[0]));
$end_str = ereg_replace(" ", " ", period_time_string($row[1], -1));
switch (cmp3($row[0], $midnight[$day_num]) . cmp3($row[1], $midnight_tonight[$day_num] + 1)) {
case "> < ":
# Starts after midnight, ends before midnight
# Starts after midnight, ends before midnight
case "= < ":
# Starts at midnight, ends before midnight
$d[$day_num]["data"][] = $start_str . "~" . $end_str;
break;
case "> = ":
# Starts after midnight, ends at midnight
$d[$day_num]["data"][] = $start_str . "~24:00";
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = $start_str . "~====>";
示例3: htmlspecialchars
case "< < ":
// Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time']));
break;
case "< = ":
// Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = period_time_string($row['start_time']);
$end_str = period_time_string($row['end_time'], -1);
switch (cmp3($row['start_time'], $midnight[$day_num]) . cmp3($row['end_time'], $midnight_tonight[$day_num] + 1)) {
case "> < ":
// Starts after midnight, ends before midnight
// Starts after midnight, ends before midnight
case "= < ":
// Starts at midnight, ends before midnight
$d[$day_num]["data"][] = $start_str . "~" . $end_str;
break;
case "> = ":
// Starts after midnight, ends at midnight
$d[$day_num]["data"][] = $start_str . "~24:00";
break;
case "> > ":
// Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = $start_str . "~====>";
示例4: htmlspecialchars
case "< < ":
# Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row[1]));
break;
case "< = ":
# Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
# Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = ereg_replace(" ", " ", htmlspecialchars(period_time_string($row[0])));
$end_str = ereg_replace(" ", " ", htmlspecialchars(period_time_string($row[1], -1)));
switch (cmp3($row[0], $midnight[$day_num]) . cmp3($row[1], $midnight_tonight[$day_num] + 1)) {
case "> < ":
# Starts after midnight, ends before midnight
# Starts after midnight, ends before midnight
case "= < ":
# Starts at midnight, ends before midnight
$d[$day_num]["data"][] = $start_str . "~" . $end_str;
break;
case "> = ":
# Starts after midnight, ends at midnight
$d[$day_num]["data"][] = $start_str . "~24:00";
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = $start_str . "~====>";
示例5: get_booking_summary
function get_booking_summary($start, $end, $day_start, $day_end)
{
global $enable_periods;
// Use ~ (not -) to separate the start and stop times, because MSIE
// will incorrectly line break after a -.
$separator = '~';
$after_today = "====>";
$before_today = "<====";
$midnight = "24:00";
// need to fix this so it works with AM/PM configurations (and for that matter 24h)
// Localized "all day" text but with non-breaking spaces:
$all_day = preg_replace("/ /", " ", get_vocab("all_day"));
if ($enable_periods) {
$start_str = period_time_string($start);
$end_str = period_time_string($end, -1);
} else {
$start_str = htmlspecialchars(utf8_strftime(hour_min_format(), $start));
$end_str = htmlspecialchars(utf8_strftime(hour_min_format(), $end));
}
switch (cmp3($start, $day_start) . cmp3($end, $day_end + 1)) {
case "> < ":
// Starts after midnight, ends before midnight
// Starts after midnight, ends before midnight
case "= < ":
// Starts at midnight, ends before midnight
$result = $start_str;
// Don't bother showing the end if it's the same as the start period
if ($end_str !== $start_str) {
$result .= $separator . $end_str;
}
break;
case "> = ":
// Starts after midnight, ends at midnight
$result = $start_str . $separator . $midnight;
break;
case "> > ":
// Starts after midnight, continues tomorrow
$result = $start_str . $separator . $after_today;
break;
case "= = ":
// Starts at midnight, ends at midnight
$result = $all_day;
break;
case "= > ":
// Starts at midnight, continues tomorrow
$result = $all_day . $after_today;
break;
case "< < ":
// Starts before today, ends before midnight
$result = $before_today . $separator . $end_str;
break;
case "< = ":
// Starts before today, ends at midnight
$result = $before_today . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$result = $before_today . $all_day . $after_today;
break;
}
return $result;
}
示例6: preg_replace
else
$d[$day_num][$month_num][$year_num]["option_reser"][] = -1;
$d[$day_num][$month_num][$year_num]["moderation"][] = $row[11];
$midnight_tonight = $midnight + 86400;
# Describe the start and end time, accounting for "all day"
# and for entries starting before/ending after today.
# There are 9 cases, for start time < = or > midnight this morning,
# and end time < = or > midnight tonight.
# Use ~ (not -) to separate the start and stop times, because MSIE
# will incorrectly line break after a -.
$all_day2 = preg_replace("/ /", " ", $all_day);
if ($enable_periods == 'y') {
$start_str = preg_replace("/ /", " ", period_time_string($row[0]));
$end_str = preg_replace("/ /", " ", period_time_string($row[1], -1));
switch (cmp3($row[0], $midnight) . cmp3($row[1], $midnight_tonight))
{
case "> < ": # Starts after midnight, ends before midnight
case "= < ": # Starts at midnight, ends before midnight
if ($start_str == $end_str)
$d[$day_num][$month_num][$year_num]["data"][] = $start_str." - ".$row[3].$temp;
else
$d[$day_num][$month_num][$year_num]["data"][] = $start_str . "~" . $end_str." - ".$row[3].$temp;
break;
case "> = ": # Starts after midnight, ends at midnight
$d[$day_num][$month_num][$year_num]["data"][] = $start_str . "~24:00"." - ".$row[3].$temp;
break;
case "> > ": # Starts after midnight, continues tomorrow
$d[$day_num][$month_num][$year_num]["data"][] = $start_str . "~====>"." - ".$row[3].$temp;
break;