当前位置: 首页>>代码示例>>PHP>>正文


PHP toTimeString函数代码示例

本文整理汇总了PHP中toTimeString函数的典型用法代码示例。如果您正苦于以下问题:PHP toTimeString函数的具体用法?PHP toTimeString怎么用?PHP toTimeString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了toTimeString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: describe_span

function describe_span($starts, $ends)
{
    global $lang;
    $start_date = strftime('%A %d %B %Y', $starts);
    $start_time = strftime("%T", $starts);
    $duration = $ends - $starts;
    if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) {
        return $start_date . " - " . $lang["all_day"];
    }
    toTimeString($duration, $dur_units);
    return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units;
}
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:12,代码来源:report.php

示例2: describe_span

function describe_span($starts, $ends)
{
    global $twentyfourhour_format;
    $start_date = utf8_strftime('%A %d %B %Y', $starts);
    $start_time = utf8_strftime(hours_minutes_seconds_format(), $starts);
    $duration = $ends - $starts;
    if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) {
        return $start_date . " - " . get_vocab("all_day");
    }
    toTimeString($duration, $dur_units);
    return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units;
}
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:12,代码来源:report.php

示例3: describe_span

function describe_span($starts, $ends)
{
    global $twentyfourhour_format;
    $start_date = userdate($starts, '%A %d %B %Y');
    $start_time = userdate($starts, hours_minutes_seconds_format());
    $duration = $ends - $starts;
    if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) {
        return $start_date . " - " . get_string('all_day', 'block_mrbs');
    }
    toTimeString($duration, $dur_units);
    return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units;
}
开发者ID:rtsfc,项目名称:moodle-block_mrbs,代码行数:12,代码来源:report.php

示例4: describe_span

function describe_span($starts, $ends)
{
    global $twentyfourhour_format;
    $start_date = utf8_strftime('%A %d %B %Y', $starts);
    if ($twentyfourhour_format) {
        $timeformat = "%H:%M:%S";
    } else {
        # This bit's necessary, because it seems %p in strftime format
        # strings doesn't work
        $ampm = utf8_date("a", $starts);
        $timeformat = "%I:%M:%S{$ampm}";
    }
    $start_time = utf8_strftime($timeformat, $starts);
    $duration = $ends - $starts;
    if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) {
        return $start_date . " - " . get_vocab("all_day");
    }
    toTimeString($duration, $dur_units);
    return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units;
}
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:20,代码来源:report.php

示例5: describe_span

function describe_span($starts, $ends, $dformat)
{
    global $vocab, $twentyfourhour_format;
    $start_date = utf8_strftime($dformat, $starts);
    if ($twentyfourhour_format) {
        $timeformat = "%T";
    } else {
        $ampm = date("a", $starts);
        $timeformat = "%I:%M{$ampm}";
    }
    $start_time = strftime($timeformat, $starts);
    $duration = $ends - $starts;
    if ($start_time == "00:00:00" && $duration == 60 * 60 * 24) {
        return $start_date . " - " . get_vocab("all_day");
    }
    toTimeString($duration, $dur_units);
    return $start_date . " " . $start_time . " - " . $duration . " " . $dur_units;
}
开发者ID:JeromeDevome,项目名称:GRR,代码行数:18,代码来源:functions.inc.php

示例6: get_vocab

    echo '<h2>' . get_vocab('booking_in_past') . '</h2>';
    if ($rep_type != 0 && !empty($reps)) {
        echo '<p>' . get_vocab('booking_in_past_explain_with_periodicity') . $str_date . '</p>';
    } else {
        echo '<p>' . get_vocab('booking_in_past_explain') . $str_date . '</p>';
    }
    echo '<a href="' . $back . '&amp;Err=yes">' . get_vocab('returnprev') . '</a>';
    include 'include/trailer.inc.php';
    die;
}
if ($error_duree_max_resa_area == 'yes') {
    $area_id = grr_sql_query1('SELECT area_id FROM ' . TABLE_PREFIX . "_room WHERE id='" . protect_data_sql($room_id) . "'");
    $duree_max_resa_area = grr_sql_query1('SELECT duree_max_resa_area FROM ' . TABLE_PREFIX . "_area WHERE id='" . $area_id . "'");
    print_header();
    $temps_format = $duree_max_resa_area * 60;
    toTimeString($temps_format, $dur_units, true);
    echo '<h2>' . get_vocab('error_duree_max_resa_area') . $temps_format . ' ' . $dur_units . '</h2>';
    echo '<a href="' . $back . '&amp;Err=yes">' . get_vocab('returnprev') . '</a>';
    include 'include/trailer.inc.php';
    die;
}
if ($error_delais_max_resa_room == 'yes') {
    print_header();
    echo '<h2>' . get_vocab('error_delais_max_resa_room') . '</h2>';
    echo '<a href="' . $back . '&amp;Err=yes">' . get_vocab('returnprev') . '</a>';
    include 'include/trailer.inc.php';
    die;
}
if ($error_chevaussement == 'yes') {
    print_header();
    echo '<h2>' . get_vocab('error_chevaussement') . '</h2>';
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:31,代码来源:edit_entry_handler.php

示例7: list

                        } else {
                            echo '<tr><td class="E"><b>'.get_vocab('rep_rep_days').'</b> '.$opt.'</td></tr>'."\n";
                        }*/
        } else {
            $tplArrayEditEntry['pasPeriode']['opt'] = false;
        }
        if ($enable_periods == 'y') {
            list($start_period, $start_date) = period_date_string($start_time);
        } else {
            $start_date = time_date_string($start_time, $dformat);
        }
        $duration = $end_time - $start_time;
        if ($enable_periods == 'y') {
            toPeriodString($start_period, $duration, $dur_units);
        } else {
            toTimeString($duration, $dur_units, true);
        }
        $tplArrayEditEntry['pasPeriode']['startDate'] = $start_date;
        $tplArrayEditEntry['pasPeriode']['duration'] = $duration;
        $tplArrayEditEntry['pasPeriode']['durUnits'] = $dur_units;
        $tplArrayEditEntry['pasPeriode']['repEndDate'] = $rep_end_date;
        /*echo '<tr><td class="E"><b>'.get_vocab('date').get_vocab('deux_points').'</b> '.$start_date.'</td></tr>'."\n";
          echo '<tr><td class="E"><b>'.get_vocab('duration').'</b> '.$duration.' '.$dur_units.'</td></tr>'."\n";
          echo '<tr><td class="E"><b>'.get_vocab('rep_end_date').'</b> '.$rep_end_date.'</td></tr>'."\n";*/
    }
}
/*    echo '</table>',PHP_EOL;
    echo '</td>',PHP_EOL,'</tr>',PHP_EOL,'</table>',PHP_EOL;*/
$tplArrayEditEntry['vocab']['cancel'] = get_vocab('cancel');
$tplArrayEditEntry['vocab']['save'] = get_vocab('save');
$tplArrayEditEntry['vocab']['cancel'] = get_vocab('cancel');
开发者ID:nicolas-san,项目名称:GRRV4,代码行数:31,代码来源:edit_entry.php

示例8: array

    }
}
// Get the details of all the enabled areas
$areas = array();
$sql = "SELECT id, area_name, resolution, default_duration, default_duration_all_day,\n               enable_periods, timezone,\n               morningstarts, morningstarts_minutes, eveningends , eveningends_minutes,\n               max_duration_enabled, max_duration_secs, max_duration_periods\n          FROM {$tbl_area}\n         WHERE disabled=0\n      ORDER BY area_name";
$res = sql_query($sql);
if ($res) {
    for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
        // Make sure we've got the correct resolution when using periods (it's
        // probably OK anyway, but just in case)
        if ($row['enable_periods']) {
            $row['resolution'] = 60;
        }
        // Generate some derived settings
        $row['max_duration_qty'] = $row['max_duration_secs'];
        toTimeString($row['max_duration_qty'], $row['max_duration_units']);
        // Get the start and end of the booking day
        if ($row['enable_periods']) {
            $first = 12 * SECONDS_PER_HOUR;
            // If we're using periods we just go to the end of the last slot
            $last = $first + count($periods) * $row['resolution'];
        } else {
            $first = ($row['morningstarts'] * 60 + $row['morningstarts_minutes']) * 60;
            $last = ($row['eveningends'] * 60 + $row['eveningends_minutes']) * 60 + $row['resolution'];
            // If the end of the day is the same as or before the start time, then it's really on the next day
            if ($first >= $last) {
                $last += SECONDS_PER_DAY;
            }
        }
        $row['first'] = $first;
        $row['last'] = $last;
开发者ID:jberanek,项目名称:mrbs_clone,代码行数:31,代码来源:edit_entry.php

示例9: round_t_down

$starttime = round_t_down($starttime, $resolution, $am7);
$endtime = round_t_up($endtime, $resolution, $am7);
// If they asked for 0 minutes, and even after the rounding the slot length is still
// 0 minutes, push that up to 1 resolution unit.
if ($endtime == $starttime) {
    $endtime += $resolution;
}
// Now get the duration, which will be needed for email notifications
// (We do this before we adjust for DST so that the user sees what they expect to see)
$duration = $endtime - $starttime;
$date = getdate($starttime);
if ($enable_periods) {
    $period = ($date['hours'] - 12) * 60 + $date['minutes'];
    toPeriodString($period, $duration, $dur_units, FALSE);
} else {
    toTimeString($duration, $dur_units, FALSE);
}
// Adjust the endtime for DST
$endtime += cross_dst($starttime, $endtime);
if (isset($rep_type) && $rep_type != REP_NONE && isset($rep_end_month) && isset($rep_end_day) && isset($rep_end_year)) {
    // Get the repeat entry settings
    $end_date = $start_seconds + mktime(0, 0, 0, $rep_end_month, $rep_end_day, $rep_end_year);
} else {
    $rep_type = REP_NONE;
    $end_date = 0;
    // to avoid an undefined variable notice
}
if (!isset($rep_day)) {
    $rep_day = array();
}
$rep_opt = "";
开发者ID:JeremyJacquemont,项目名称:SchoolProjects,代码行数:31,代码来源:edit_entry_handler.php

示例10: create_field_entry_max_duration

function create_field_entry_max_duration()
{
    global $max_duration_enabled, $max_duration_secs, $max_duration_periods;
    // The max duration policies
    echo "<fieldset>\n";
    echo "<legend>" . get_vocab("booking_durations") . "</legend>\n";
    echo "<div>\n";
    $params = array('label' => get_vocab("max_duration") . ":", 'name' => 'area_max_duration_enabled', 'value' => $max_duration_enabled, 'class' => 'enabler');
    generate_checkbox($params);
    echo "</div>\n";
    echo "<div>\n";
    $attributes = array('class="text"', 'type="number"', 'min="0"', 'step="1"');
    $params = array('name' => 'area_max_duration_periods', 'label' => get_vocab("mode_periods") . ':', 'value' => $max_duration_periods, 'attributes' => $attributes);
    generate_input($params);
    echo "</div>\n";
    echo "<div>\n";
    $max_duration_value = $max_duration_secs;
    toTimeString($max_duration_value, $max_duration_units);
    $attributes = array('class="text"', 'type="number"', 'min="0"', 'step="1"');
    $params = array('name' => 'area_max_duration_value', 'label' => get_vocab("mode_times") . ':', 'value' => $max_duration_value, 'attributes' => $attributes);
    generate_input($params);
    $units = array("seconds", "minutes", "hours", "days", "weeks");
    $options = array();
    foreach ($units as $unit) {
        $options[$unit] = get_vocab($unit);
    }
    $params = array('name' => 'area_max_duration_units', 'value' => array_search($max_duration_units, $options), 'options' => $options);
    generate_select($params);
    echo "</div>\n";
    echo "</fieldset>\n";
}
开发者ID:cvelayo,项目名称:worklog,代码行数:31,代码来源:edit_area_room.php

示例11: isset

     $rep_opt = isset($row['rep_opt']) ? $row['rep_opt'] : NULL;
     $rep_num_weeks = isset($row['rep_num_weeks']) ? $row['rep_num_weeks'] : NULL;
     if ($enable_periods) {
         list($start_period, $start_date) = period_date_string($row['start_time']);
     } else {
         $start_date = time_date_string($row['start_time']);
     }
     if ($enable_periods) {
         list(, $end_date) = period_date_string($row['end_time'], -1);
     } else {
         $end_date = time_date_string($row['end_time']);
     }
     // The optional last parameters below are set to FALSE because we don't want the units
     // translated - otherwise they will end up getting translated twice, resulting
     // in an undefined index error.
     $enable_periods ? toPeriodString($start_period, $duration, $dur_units, FALSE) : toTimeString($duration, $dur_units, FALSE);
 }
 // Now that we know the room, check that we have confirm rights for it if necessary
 if (($action == "accept" || $action == "reject") && !auth_book_admin($user, $room_id)) {
     showAccessDenied($day, $month, $year, $area, isset($room) ? $room : "");
     exit;
 }
 // ACTION = "ACCEPT"
 if ($action == "accept") {
     if (!mrbsConfirmEntry($id, $series)) {
         $returl .= "&error=accept_failed";
     } elseif ($need_to_send_mail) {
         $result = notifyAdminOnBooking(TRUE, $id, $series, $action);
     }
 }
 // ACTION = "MORE_INFO"
开发者ID:jessfishenden,项目名称:mrbs,代码行数:31,代码来源:confirm_entry_handler.php

示例12: getPreviousEntryData


//.........这里部分代码省略.........
    $mail_previous['room_admin_email'] = $row['room_admin_email'];
    // If we use periods
    if ($enable_periods) {
        // If we delete a serie, start_time and end_time must
        // come from $tbl_repeat, not $tbl_entry.
        //
        // This is not a serie
        if (1 != $series) {
            list($mail_previous['start_period'], $mail_previous['start_date']) = getMailPeriodDateString($row['tbl_e_start_time']);
            list($mail_previous['end_period'], $mail_previous['end_date']) = getMailPeriodDateString($row['tbl_e_end_time'], -1);
            // need to make DST correct in opposite direction to entry creation
            // so that user see what he expects to see
            $mail_previous['duration'] = $row['tbl_e_duration'] - cross_dst($row['tbl_e_start_time'], $row['tbl_e_end_time']);
        } else {
            list($mail_previous['start_period'], $mail_previous['start_date']) = getMailPeriodDateString($row['tbl_r_start_time']);
            list($mail_previous['end_period'], $mail_previous['end_date']) = getMailPeriodDateString($row['tbl_r_end_time'], 0);
            // use getMailTimeDateString as all I want is the date
            $mail_previous['rep_end_date'] = getMailTimeDateString($row['tbl_r_end_date'], FALSE);
            // need to make DST correct in opposite direction to entry creation
            // so that user see what he expects to see
            $mail_previous['duration'] = $row['tbl_r_duration'] - cross_dst($row['tbl_r_start_time'], $row['tbl_r_end_time']);
            $mail_previous['rep_opt'] = "";
            switch ($row['rep_type']) {
                case 2:
                case 6:
                    $rep_day[0] = $row['rep_opt'][0] != "0";
                    $rep_day[1] = $row['rep_opt'][1] != "0";
                    $rep_day[2] = $row['rep_opt'][2] != "0";
                    $rep_day[3] = $row['rep_opt'][3] != "0";
                    $rep_day[4] = $row['rep_opt'][4] != "0";
                    $rep_day[5] = $row['rep_opt'][5] != "0";
                    $rep_day[6] = $row['rep_opt'][6] != "0";
                    if ($row['rep_type'] == 6) {
                        $mail_previous['rep_num_weeks'] = $row['rep_num_weeks'];
                    } else {
                        $mail_previous['rep_num_weeks'] = "";
                    }
                    break;
                default:
                    $rep_day = array(0, 0, 0, 0, 0, 0, 0);
            }
            for ($i = 0; $i < 7; $i++) {
                $wday = ($i + $weekstarts) % 7;
                if ($rep_day[$wday]) {
                    $mail_previous['rep_opt'] .= day_name($wday) . " ";
                }
            }
            $mail_previous['rep_num_weeks'] = $row['rep_num_weeks'];
        }
        toPeriodString($mail_previous['start_period'], $mail_previous['duration'], $mail_previous['dur_units']);
    } else {
        // This is not a serie
        if (1 != $series) {
            $mail_previous['start_date'] = getMailTimeDateString($row['tbl_e_start_time']);
            $mail_previous['end_date'] = getMailTimeDateString($row['tbl_e_end_time']);
            // need to make DST correct in opposite direction to entry creation
            // so that user see what he expects to see
            $mail_previous['duration'] = $row['tbl_e_duration'] - cross_dst($row['tbl_e_start_time'], $row['tbl_e_end_time']);
        } else {
            $mail_previous['start_date'] = getMailTimeDateString($row['tbl_r_start_time']);
            $mail_previous['end_date'] = getMailTimeDateString($row['tbl_r_end_time']);
            // use getMailTimeDateString as all I want is the date
            $mail_previous['rep_end_date'] = getMailTimeDateString($row['tbl_r_end_date'], FALSE);
            // need to make DST correct in opposite direction to entry creation
            // so that user see what he expects to see
            $mail_previous['duration'] = $row['tbl_r_duration'] - cross_dst($row['tbl_r_start_time'], $row['tbl_r_end_time']);
            $mail_previous['rep_opt'] = "";
            switch ($row['rep_type']) {
                case 2:
                case 6:
                    $rep_day[0] = $row['rep_opt'][0] != "0";
                    $rep_day[1] = $row['rep_opt'][1] != "0";
                    $rep_day[2] = $row['rep_opt'][2] != "0";
                    $rep_day[3] = $row['rep_opt'][3] != "0";
                    $rep_day[4] = $row['rep_opt'][4] != "0";
                    $rep_day[5] = $row['rep_opt'][5] != "0";
                    $rep_day[6] = $row['rep_opt'][6] != "0";
                    if ($row['rep_type'] == 6) {
                        $mail_previous['rep_num_weeks'] = $row['rep_num_weeks'];
                    } else {
                        $mail_previous['rep_num_weeks'] = "";
                    }
                    break;
                default:
                    $rep_day = array(0, 0, 0, 0, 0, 0, 0);
            }
            for ($i = 0; $i < 7; $i++) {
                $wday = ($i + $weekstarts) % 7;
                if ($rep_day[$wday]) {
                    $mail_previous['rep_opt'] .= day_name($wday) . " ";
                }
            }
            $mail_previous['rep_num_weeks'] = $row['rep_num_weeks'];
        }
        toTimeString($mail_previous['duration'], $mail_previous['dur_units']);
    }
    1 == $series ? $mail_previous['rep_type'] = $row['rep_type'] : ($mail_previous['rep_type'] = 0);
    // return entry previous data as an array
    return $mail_previous;
}
开发者ID:rtsfc,项目名称:moodle-block_mrbs,代码行数:101,代码来源:functions.php

示例13: toPeriodString

}
# If we have not been provided with starting time
if (empty($start_hour) && $morningstarts < 10) {
    $start_hour = "0{$morningstarts}";
}
if (empty($start_hour)) {
    $start_hour = "{$morningstarts}";
}
if (empty($start_min)) {
    $start_min = "00";
}
// Remove "Undefined variable" notice
if (!isset($rep_num_weeks)) {
    $rep_num_weeks = "";
}
$enable_periods ? toPeriodString($start_min, $duration, $dur_units) : toTimeString($duration, $dur_units);
#now that we know all the data to fill the form with we start drawing it
if (!getWritable($create_by, getUserName())) {
    showAccessDenied($day, $month, $year, $area);
    exit;
}
print_header($day, $month, $year, $area);
?>

<SCRIPT LANGUAGE="JavaScript">
// do a little form verifying
function validate_and_submit ()
{
  // null strings and spaces only strings not allowed
  if(/(^$)|(^\s+$)/.test(document.forms["main"].name.value))
  {
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:edit_entry.php

示例14: array

    $start_day = $day;
    $start_month = $month;
    $start_year = $year;
    $start_hour = $hour;
    $start_min = $minute;
    $duration = 60 * 60;
    $type = "I";
    $room_id = $room;
    $rep_id = 0;
    $rep_type = 0;
    $rep_end_day = $day;
    $rep_end_month = $month;
    $rep_end_year = $year;
    $rep_day = array(0, 0, 0, 0, 0, 0, 0);
}
toTimeString($duration, $dur_units);
#now that we know all the data to fill the form with we start drawing it
if (!getWritable($create_by, getUserName())) {
    showAccessDenied($day, $month, $year, $area);
    exit;
}
print_header($day, $month, $year, $area);
?>

<SCRIPT LANGUAGE="JavaScript">
// do a little form verifying
function validate_and_submit ()
{
  if(document.forms["main"].name.value == "")
  {
    alert ( "You have not entered a\nBrief Description." );
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:edit_entry.php

示例15: utf8_strftime

     echo "<div class=\"group ampm\">\n";
     $checked = $eveningends < 12 ? "checked=\"checked\"" : "";
     echo "<label><input name=\"area_evening_ampm\" type=\"radio\" value=\"am\" {$checked}>" . utf8_strftime($strftime_format['ampm'], mktime(1, 0, 0, 1, 1, 2000)) . "</label>\n";
     $checked = $eveningends >= 12 ? "checked=\"checked\"" : "";
     echo "<label><input name=\"area_evening_ampm\" type=\"radio\" value=\"pm\" {$checked}>" . utf8_strftime($strftime_format['ampm'], mktime(13, 0, 0, 1, 1, 2000)) . "</label>\n";
     echo "</div>\n";
 }
 echo "</div>\n";
 echo "</div>\n";
 // last_slot
 echo "</fieldset>\n";
 // Booking policies
 $min_ba_value = $min_book_ahead_secs;
 toTimeString($min_ba_value, $min_ba_units);
 $max_ba_value = $max_book_ahead_secs;
 toTimeString($max_ba_value, $max_ba_units);
 echo "<fieldset id=\"booking_policies\">\n";
 echo "<legend>" . get_vocab("booking_policies") . "</legend>\n";
 // Note when using periods
 echo "<div id=\"book_ahead_periods_note\"" . ($enable_periods ? '' : ' class="js_none"') . ">\n";
 echo "<label></label><span>" . get_vocab("book_ahead_note_periods") . "</span>";
 echo "</div>\n";
 // Minimum book ahead
 echo "<div>\n";
 $params = array('label' => get_vocab("min_book_ahead") . ":", 'name' => 'area_min_ba_enabled', 'value' => $min_book_ahead_enabled, 'class' => 'enabler');
 generate_checkbox($params);
 $attributes = array('class="text"', 'type="number"', 'min="0"', 'step="1"');
 $params = array('name' => 'area_min_ba_value', 'value' => $min_ba_value, 'attributes' => $attributes);
 generate_input($params);
 $units = array("seconds", "minutes", "hours", "days", "weeks");
 $options = array();
开发者ID:linuxmuster,项目名称:linuxmuster-mrbs-manager,代码行数:31,代码来源:edit_area_room.php


注:本文中的toTimeString函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。