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


PHP find_day_in_month函数代码示例

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


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

示例1: dst_changes_for_year

/**
 * Calculates the required DST change and returns a Timestamp Array
 *
 * @package core
 * @category time
 * @uses HOURSECS
 * @uses MINSECS
 * @param int|string $year Int or String Year to focus on
 * @param object $timezone Instatiated Timezone object
 * @return array|null Array dst => xx, 0 => xx, std => yy, 1 => yy or null
 */
function dst_changes_for_year($year, $timezone) {

    if ($timezone->dst_startday == 0 && $timezone->dst_weekday == 0 &&
        $timezone->std_startday == 0 && $timezone->std_weekday == 0) {
        return null;
    }

    $monthdaydst = find_day_in_month($timezone->dst_startday, $timezone->dst_weekday, $timezone->dst_month, $year);
    $monthdaystd = find_day_in_month($timezone->std_startday, $timezone->std_weekday, $timezone->std_month, $year);

    list($dsthour, $dstmin) = explode(':', $timezone->dst_time);
    list($stdhour, $stdmin) = explode(':', $timezone->std_time);

    $timedst = make_timestamp($year, $timezone->dst_month, $monthdaydst, 0, 0, 0, 99, false);
    $timestd = make_timestamp($year, $timezone->std_month, $monthdaystd, 0, 0, 0, 99, false);

    // Instead of putting hour and minute in make_timestamp(), we add them afterwards.
    // This has the advantage of being able to have negative values for hour, i.e. for timezones
    // where GMT time would be in the PREVIOUS day than the local one on which DST changes.

    $timedst += $dsthour * HOURSECS + $dstmin * MINSECS;
    $timestd += $stdhour * HOURSECS + $stdmin * MINSECS;

    return array('dst' => $timedst, 0 => $timedst, 'std' => $timestd, 1 => $timestd);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:36,代码来源:moodlelib.php

示例2: get_user_preferences

 case 'weeknext':
     $startweekday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY);
     $startmonthday = find_day_in_month($now['mday'] + 1, $startweekday, $now['mon'], $now['year']);
     $startmonth = $now['mon'];
     $startyear = $now['year'];
     if ($startmonthday > calendar_days_in_month($startmonth, $startyear)) {
         list($startmonth, $startyear) = calendar_add_month($startmonth, $startyear);
         $startmonthday = find_day_in_month(1, $startweekday, $startmonth, $startyear);
     }
     $timestart = make_timestamp($startyear, $startmonth, $startmonthday);
     $endmonthday = $startmonthday + 7;
     $endmonth = $startmonth;
     $endyear = $startyear;
     if ($endmonthday > calendar_days_in_month($endmonth, $endyear)) {
         list($endmonth, $endyear) = calendar_add_month($endmonth, $endyear);
         $endmonthday = find_day_in_month(1, $startweekday, $endmonth, $endyear);
     }
     $timeend = make_timestamp($endyear, $endmonth, $endmonthday) - 1;
     break;
 case 'monthnow':
     $timestart = make_timestamp($now['year'], $now['mon'], 1);
     $timeend = make_timestamp($now['year'], $now['mon'], calendar_days_in_month($now['mon'], $now['year']), 23, 59, 59);
     break;
 case 'monthnext':
     list($nextmonth, $nextyear) = calendar_add_month($now['mon'], $now['year']);
     $timestart = make_timestamp($nextyear, $nextmonth, 1);
     $timeend = make_timestamp($nextyear, $nextmonth, calendar_days_in_month($nextmonth, $nextyear), 23, 59, 59);
     break;
 case 'recentupcoming':
     //Events in the last 5 or next 60 days
     $timestart = time() - 432000;
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:export_execute.php


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