IntlCalendar::isWeekend

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

IntlCalendar::isWeekendWhether a certain date/time is in the weekend

說(shuō)明

面向?qū)ο箫L(fēng)格

public IntlCalendar::isWeekend(?float $timestamp = null): bool

過(guò)程化風(fēng)格

intlcal_is_weekend(IntlCalendar $calendar, ?float $timestamp = null): bool

Returns whether either the obejct?s current time or the provided timestamp occur during a weekend in this object?s calendar system.

This function requires ICU 4.4 or later.

參數(shù)

calendar

IntlCalendar 實(shí)例。

timestamp

An optional timestamp representing the number of milliseconds since the epoch, excluding leap seconds. If null, this object?s current time is used instead.

返回值

A bool indicating whether the given or this object?s time occurs in a weekend.

On failure false is also returned. To detect error conditions use intl_get_error_code(), or set up Intl to throw exceptions.

范例

示例 #1 IntlCalendar::isWeekend()

<?php
ini_set
('date.timezone''Europe/Lisbon');

$cal = new IntlGregorianCalendar(NULL'en_US');
$cal->set(2013/* July */7); // a Sunday 

var_dump($cal->isWeekend()); // true
var_dump($cal->isWeekend(strtotime('2013-07-01 00:00:00'))); // false, Monday

$cal = new IntlGregorianCalendar(NULL'ar_SA');
$cal->set(2013/* July */7); // a Sunday 
var_dump($cal->isWeekend()); // false, Sunday not in weekend in this calendar

參見(jiàn)