略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: IntlCalendar::getFirstDayOfWeek

2024-12-21

IntlCalendar::getFirstDayOfWeek

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

IntlCalendar::getFirstDayOfWeekGet the first day of the week for the calendarʼs locale

说明

面向对象风格

public IntlCalendar::getFirstDayOfWeek(): int|false

过程化风格

intlcal_get_first_day_of_week(IntlCalendar $calendar): int|false

The week day deemed to start a week, either the default value for this locale or the value set with IntlCalendar::setFirstDayOfWeek().

参数

calendar

IntlCalendar 实例。

返回值

One of the constants IntlCalendar::DOW_SUNDAY, IntlCalendar::DOW_MONDAY, …, IntlCalendar::DOW_SATURDAY 或者在失败时返回 false.

范例

示例 #1 IntlCalendar::getFirstDayOfWeek()

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

$cal1 IntlCalendar::createInstance(NULL'es_ES');
var_dump($cal1->getFirstDayOfWeek()); // Monday
$cal1->set(2013/* February */3); // a Sunday
var_dump($cal1->get(IntlCalendar::FIELD_WEEK_OF_YEAR)); // 5

$cal2 IntlCalendar::createInstance(NULL'en_US');
var_dump($cal2->getFirstDayOfWeek()); // Sunday
$cal2->set(2013/* February */3); // a Sunday
var_dump($cal2->get(IntlCalendar::FIELD_WEEK_OF_YEAR)); // 6

以上例程会输出:

int(2)
int(5)
int(1)
int(6)

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/intlcalendar.getfirstdayofweek.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3