本文整理汇总了PHP中TimeDate::getWeekDayName方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::getWeekDayName方法的具体用法?PHP TimeDate::getWeekDayName怎么用?PHP TimeDate::getWeekDayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::getWeekDayName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDateFromRules
/**
* function getDateFromRules($year, $startMonth, $startDate, $weekday, $startTime )
* Converts the rules for a timezones dst into a string representation of a date for the given year
*
* @param STRING(YEAR) $year
* @param INT(MONTH INDEX) $startMonth
* @param INT(DATE INDEX) $startDate
* @param INT(WEEKDAY INDEX) $weekday
* @param INT(START TIME IN SECONDS) $startTime
* @return unknown
*/
function getDateFromRules($year, $startMonth, $startDate, $weekday, $startTime)
{
if ($weekday < 0) {
return date('Y-m-d H:i:s', strtotime("{$year}-{$startMonth}-{$startDate}") + $startTime);
}
$dayname = TimeDate::getWeekDayName($weekday);
if ($startDate > 0) {
$startMonth--;
}
$month = TimeDate::getMonthName($startMonth);
$startWeek = floor($startDate / 7);
//echo "$startWeek week $dayname - $month 1, $year<br>";
return date('Y-m-d H:i:s', strtotime("{$startWeek} week {$dayname}", strtotime("{$month} 1, {$year}")) + $startTime);
}