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 cubrid 函数 get the number of rows in the result setphp db++ 函数 get first tuple from relationphp sqlite 函数 seek to the first row numberphp tidy 函数 returns the number of tidy accessibility warnings encountered for specified documentphp yp/nis 函数 returns the first key value pair from the named mapphp harufont get the total width of the text number of characters number of words and number of spacesphp harufont calculate the number of characters which can be included within the specified widthphp 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 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 multipleiterator gets the number of attached iterator instancesphp mysqli stmt returns the number of parameter for the given statementphp mysqlnduhconnection returns the number of warnings from the last query for the given linkphp phar returns true if the phar archive can be modifiedphp recursiveiterator returns if an iterator can be created for the current entryphp recursiveiteratoriterator rewind the iterator to the first element of the top level inner iteratorphp solrquery if true solr includes the number of groups that have matched the query in the resultsphp zookeeper checks if the current zookeeper connection state can be recovered
关注编程学问公众号