IntlCalendar::getMinimalDaysInFirstWeek

(PHP 5 >= 5.5.0, PHP 7, PECL >= 3.0.0a1)

IntlCalendar::getMinimalDaysInFirstWeekGet minimal number of days the first week in a year or month can have

说明

面向对象风格

public IntlCalendar::getMinimalDaysInFirstWeek ( void ) : int

过程化风格

intlcal_get_minimal_days_in_first_week ( IntlCalendar $cal ) : int

Returns the smallest number of days the first week of a year or month must have in the new year or month. For instance, in the Gregorian calendar, if this value is 1, then the first week of the year will necessarily include January 1st, while if this value is 7, then the week with January 1st will be the first week of the year only if the day of the week for January 1st matches the day of the week returned by IntlCalendar::getFirstDayOfWeek(); otherwise it will be the previous yearʼs last week.

参数

cal

The IntlCalendar resource.

返回值

An int representing a number of days 或者在失败时返回 FALSE.

范例

Example #1 IntlCalendar::getMinimalDaysInFirstWeek()

<?php
ini_set
('date.timezone''UTC');
ini_set('intl.default_locale''en_US');

$cal = new IntlGregorianCalendar(2013/* January */2);
var_dump(IntlDateFormatter::formatObject($cal'cccc')); // Wednesday

var_dump($cal->getMinimalDaysInFirstWeek(), // 1
$cal->getFirstDayofWeek()); // 1 (Sunday)

// Week 1 of 2013
var_dump(IntlDateFormatter::formatObject($cal"'Week 'w' of 'Y"));

$cal->setMinimalDaysInFirstWeek(4);
// Still Week 1 of 2013 (1st week has 5 days in the new year)
var_dump(IntlDateFormatter::formatObject($cal"'Week 'w' of 'Y"));

$cal->setMinimalDaysInFirstWeek(6);
// Week 53 of 2012
var_dump(IntlDateFormatter::formatObject($cal"'Week 'w' of 'Y"));

以上例程会输出:

string(9) "Wednesday"
int(1)
int(1)
string(14) "Week 1 of 2013"
string(14) "Week 1 of 2013"
string(15) "Week 53 of 2012"

相关文章
php mcve 函数 returns array of strings which represents the keys that can be used for response parameters on this transactionphp maxdb 函数 returns the number of parameter for the given statementphp odbc 函数 return column numberphp sqlite 函数 seek to the first row numberphp harufont calculate the number of characters which can be included within the specified widthphp intlcalendar get last error message on the objectphp intlcalendar get the first day of the week for the calendarʼs localephp intlcalendar get minimal number of days the first week in a year or month can havephp intlcalendar get number representing the current timephp intlcalendar whether the objectʼs time is in daylight savings timephp intlcalendar set the day on which the week is deemed to startphp intlcalendar set minimal number of days the first week in a year or month can havephp solrinputdocument returns the number of fields in the documentphp solrquery returns the lower bound for the first date range for all date faceting on this fieldphp solrquery returns the maximum number of characters of the field to returnphp solrquery returns the maximum number of tokens to parse in each document field that is not stored with termvector supportphp solrquery if true the result of the first field grouping command is used as the main result list in the response using group.format=simplephp solrquery if true solr includes the number of groups that have matched the query in the resultsphp solrquery specifies the maximum number of rows to return in the resultphp splfileobject rewind the file to the first line
关注编程学问公众号