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


PHP get_sunday_before函数代码示例

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


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

示例1: display_small_month

function display_small_month($thismonth, $thisyear, $showyear)
{
    global $WEEK_START, $user, $login;
    if ($user != $login && !empty($user)) {
        $u_url = "&user={$user}";
    } else {
        $u_url = "";
    }
    echo "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"2\">";
    if ($WEEK_START == "1") {
        $wkstart = get_monday_before($thisyear, $thismonth, 1);
    } else {
        $wkstart = get_sunday_before($thisyear, $thismonth, 1);
    }
    $monthstart = mktime(2, 0, 0, $thismonth, 1, $thisyear);
    $monthend = mktime(2, 0, 0, $thismonth + 1, 0, $thisyear);
    echo "<TR><TD COLSPAN=\"7\" ALIGN=\"center\">" . "<A HREF=\"month.php?year={$thisyear}&month={$thismonth}" . $u_url . "\" CLASS=\"monthlink\">";
    echo month_name($thismonth - 1) . "</A></TD></TR>";
    echo "<TR>";
    if ($WEEK_START == 0) {
        echo "<TD><FONT SIZE=\"-3\">" . weekday_short_name(0) . "</TD>";
    }
    for ($i = 1; $i < 7; $i++) {
        echo "<TD><FONT SIZE=\"-3\">" . weekday_short_name($i) . "</TD>";
    }
    if ($WEEK_START == 1) {
        echo "<TD><FONT SIZE=\"-3\">" . weekday_short_name(0) . "</TD>";
    }
    for ($i = $wkstart; date("Ymd", $i) <= date("Ymd", $monthend); $i += 24 * 3600 * 7) {
        echo "<TR>";
        for ($j = 0; $j < 7; $j++) {
            $date = $i + $j * 24 * 3600;
            if (date("Ymd", $date) >= date("Ymd", $monthstart) && date("Ymd", $date) <= date("Ymd", $monthend)) {
                echo "<TD ALIGN=\"right\"><A HREF=\"day.php?date=" . date("Ymd", $date) . $u_url . "\" CLASS=\"dayofmonthyearview\">";
                echo "<FONT SIZE=\"-1\">" . date("j", $date) . "</A></FONT></TD>";
            } else {
                echo "<TD></TD>";
            }
        }
        // end for $j
        echo "</TR>";
    }
    // end for $i
    echo "</TABLE>";
}
开发者ID:neuroidss,项目名称:virtuoso-opensource,代码行数:45,代码来源:year.php

示例2: mktime

$next = mktime(3, 0, 0, $thismonth, $thisday + 7, $thisyear);
$nextyear = date("Y", $next);
$nextmonth = date("m", $next);
$nextday = date("d", $next);
$nextdate = sprintf("%04d%02d%02d", $nextyear, $nextmonth, $nextday);
$prev = mktime(3, 0, 0, $thismonth, $thisday - 7, $thisyear);
$prevyear = date("Y", $prev);
$prevmonth = date("m", $prev);
$prevday = date("d", $prev);
$prevdate = sprintf("%04d%02d%02d", $prevyear, $prevmonth, $prevday);
// We add 2 hours on to the time so that the switch to DST doesn't
// throw us off.  So, all our dates are 2AM for that day.
if ($WEEK_START == 1) {
    $wkstart = get_monday_before($thisyear, $thismonth, $thisday);
} else {
    $wkstart = get_sunday_before($thisyear, $thismonth, $thisday);
}
$wkend = $wkstart + 3600 * 24 * 6;
$startdate = date("Ymd", $wkstart);
$enddate = date("Ymd", $wkend);
$thisdate = $startdate;
for ($i = 0; $i < 7; $i++) {
    $days[$i] = $wkstart + 24 * 3600 * $i;
    $weekdays[$i] = weekday_short_name(($i + $WEEK_START) % 7);
    $header[$i] = $weekdays[$i] . "<br />" . month_short_name(date("m", $days[$i]) - 1) . " " . date("d", $days[$i]);
}
?>

<div style="border-width:0px; width:99%;">
<a title="<?php 
etranslate("Previous");
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:view_v.php

示例3: mktime

    echo $prefarray["BGCOLOR"];
    ?>
;">
<br />

<!-- BEGIN EXAMPLE MONTH -->
<table style="border:0px; width:100%;"><tr>
<td style="text-align:center; color:<?php 
    echo $H2COLOR;
    ?>
; font-weight:bold;"><?php 
    $today = mktime(3, 0, 0, 12, 13, 2000);
    if ($prefarray["WEEK_START"] == 1) {
        $wkstart = get_monday_before(2000, 12, 1);
    } else {
        $wkstart = get_sunday_before(2000, 12, 1);
    }
    echo date_to_str("20001201", $DATE_FORMAT_MY, false, false);
    ?>
</td></tr>
</table>

<table style="border-width:0px; width:90%;" cellspacing="0" cellpadding="0">
<tr><td style="background-color:<?php 
    echo $TABLEBG;
    ?>
;">
<table style="border-width:0px; width:100%;" cellspacing="1" cellpadding="2">
<tr>
<?php 
    if ($prefarray["WEEK_START"] == 0) {
开发者ID:rohcehlam,项目名称:rflow,代码行数:31,代码来源:pref.php

示例4: get_monday_before

     if ($WEEK_START == 1) {
         $wkstart = get_monday_before(date("Y"), date("m"), date("d"));
     } else {
         $wkstart = get_sunday_before(date("Y"), date("m"), date("d"));
     }
     //echo "wkstart = " . date("Ymd",$wkstart) . "<br />";
     $week_offset = 11 - $report_time_range + $offset;
     //echo "week_offset=$week_offset <br />";
     $start_date = date("Ymd", $wkstart + $week_offset * 7 * $ONE_DAY);
     $end_date = date("Ymd", $wkstart + $week_offset * 7 * $ONE_DAY + $ONE_DAY * 6);
 } else {
     if ($report_time_range >= 20 && $report_time_range < 30) {
         if ($WEEK_START == 1) {
             $wkstart = get_monday_before(date("Y"), date("m"), date("d"));
         } else {
             $wkstart = get_sunday_before(date("Y"), date("m"), date("d"));
         }
         //echo "wkstart = " . date("Ymd",$wkstart) . "<br />";
         $week_offset = 21 - $report_time_range + $offset;
         //echo "week_offset=$week_offset <br />";
         $start_date = date("Ymd", $wkstart + $week_offset * 7 * $ONE_DAY);
         $end_date = date("Ymd", $wkstart + $week_offset * 7 * $ONE_DAY + $ONE_DAY * 13);
     } else {
         if ($report_time_range >= 30 && $report_time_range < 40) {
             $thismonth = date("m");
             $month_offset = 31 - $report_time_range + $offset;
             //echo "month_offset=$month_offset <br />";
             $start_date = date("Ymd", mktime(3, 0, 0, $thismonth + $month_offset, 1, date("Y")));
             $end_date = date("Ymd", mktime(3, 0, 0, $thismonth + $month_offset + 1, 0, date("Y")));
         } else {
             if ($report_time_range >= 40 && $report_time_range < 50) {
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:report.php

示例5: display_small_month

function display_small_month($thismonth, $thisyear, $showyear, $show_weeknums = false, $minical_id = '', $month_link = 'month.php?')
{
    global $WEEK_START, $user, $login, $boldDays, $get_unapproved;
    global $DISPLAY_WEEKNUMBER;
    global $SCRIPT, $thisday;
    // Needed for day.php
    // TODO: Make day.php NOT be a special case
    if ($user != $login && !empty($user)) {
        $u_url = "user={$user}";
    } else {
        $u_url = '';
    }
    //start the minical table for each month
    echo "\n<table class=\"minical\"";
    if ($minical_id != '') {
        echo " id=\"{$minical_id}\"";
    }
    echo ">\n";
    $monthstart = mktime(2, 0, 0, $thismonth, 1, $thisyear);
    $monthend = mktime(2, 0, 0, $thismonth + 1, 0, $thisyear);
    if ($SCRIPT == 'day.php') {
        $month_ago = date("Ymd", mktime(3, 0, 0, $thismonth - 1, $thisday, $thisyear));
        $month_ahead = date("Ymd", mktime(3, 0, 0, $thismonth + 1, $thisday, $thisyear));
        echo "<caption>{$thisday}</caption>\n";
        echo "<thead>\n";
        echo "<tr class=\"monthnav\"><th colspan=\"7\">\n";
        echo "<a title=\"" . translate("Previous") . "\" class=\"prev\" href=\"day.php?" . (empty($u_url) ? '' : $u_url . '&amp;') . "date={$month_ago}{$caturl}\"><img src=\"leftarrowsmall.gif\" alt=\"" . translate("Previous") . "\" /></a>\n";
        echo "<a title=\"" . translate("Next") . "\" class=\"next\" href=\"day.php?" . (empty($u_url) ? '' : $u_url . '&amp;') . "date={$month_ahead}{$caturl}\"><img src=\"rightarrowsmall.gif\" alt=\"" . translate("Next") . "\" /></a>\n";
        echo month_name($thismonth - 1);
        if ($showyear != '') {
            echo " {$thisyear}";
        }
        echo "</th></tr>\n";
    } else {
        //print the month name
        echo "<caption><a href=\"{$month_link}{$u_url}&amp;year={$thisyear}&amp;month={$thismonth}\">";
        echo month_name($thismonth - 1) . ($showyear ? " {$thisyear}" : "");
        echo "</a></caption>\n";
        echo "<thead>\n<tr>\n";
    }
    //determine if the week starts on sunday or monday
    if ($WEEK_START == "1") {
        $wkstart = get_monday_before($thisyear, $thismonth, 1);
    } else {
        $wkstart = get_sunday_before($thisyear, $thismonth, 1);
    }
    //print the headers to display the day of the week (sun, mon, tues, etc.)
    // if we're showing week numbers we need an extra column
    if ($show_weeknums && $DISPLAY_WEEKNUMBER == 'Y') {
        echo "<th class=\"empty\">&nbsp;</th>\n";
    }
    //if the week doesn't start on monday, print the day
    if ($WEEK_START == 0) {
        echo "<th>" . weekday_short_name(0) . "</th>\n";
    }
    //cycle through each day of the week until gone
    for ($i = 1; $i < 7; $i++) {
        echo "<th>" . weekday_short_name($i) . "</th>\n";
    }
    //if the week DOES start on monday, print sunday
    if ($WEEK_START == 1) {
        echo "<th>" . weekday_short_name(0) . "</th>\n";
    }
    //end the header row
    echo "</tr>\n</thead>\n<tbody>\n";
    for ($i = $wkstart; date("Ymd", $i) <= date("Ymd", $monthend); $i += 24 * 3600 * 7) {
        echo "<tr>\n";
        if ($show_weeknums && $DISPLAY_WEEKNUMBER == 'Y') {
            echo "<td class=\"weeknumber\"><a href=\"week.php?" . (empty($u_url) ? '' : $u_url . '&amp;') . "date=" . date("Ymd", $i) . "\">(" . week_number($i) . ")</a></td>\n";
        }
        for ($j = 0; $j < 7; $j++) {
            $date = $i + $j * 24 * 3600;
            $dateYmd = date("Ymd", $date);
            $hasEvents = false;
            if ($boldDays) {
                $ev = get_entries($user, $dateYmd, $get_unapproved);
                if (count($ev) > 0) {
                    $hasEvents = true;
                } else {
                    $rep = get_repeating_entries($user, $dateYmd, $get_unapproved);
                    if (count($rep) > 0) {
                        $hasEvents = true;
                    }
                }
            }
            if ($dateYmd >= date("Ymd", $monthstart) && $dateYmd <= date("Ymd", $monthend)) {
                echo "<td";
                $wday = date('w', $date);
                $class = '';
                //add class="weekend" if it's saturday or sunday
                if ($wday == 0 || $wday == 6) {
                    $class = "weekend";
                }
                //if the day being viewed is today's date
                if ($dateYmd == $thisyear . $thismonth . $thisday) {
                    //if it's also a weekend, add a space between class names to combine styles
                    if ($class != '') {
                        $class .= ' ';
                    }
                    $class .= "selectedday";
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:fhnreposit,代码行数:101,代码来源:functions.php


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