PHP Conference Nagoya 2025

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

Açıklama

Nesne yönelimli kullanım

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

Yordamsal kullanım

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.

Bağımsız Değişkenler

calendar

IntlCalendar örneği.

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.

Dönen Değerler

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

Başarısızlık durumunda ayrıca false döner. Hataları yakalamak için ya intl_get_error_code() işlevini kullanın ya da Intl eklentisini istisnaları yavrulamaya ayarlayın.

Örnekler

Örnek 1 IntlCalendar::isWeekend()

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

$cal = new IntlGregorianCalendar(NULL, 'en_US');
$cal->set(2013, 6 /* 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, 6 /* July */, 7); // a Sunday
var_dump($cal->isWeekend()); // false, Sunday not in weekend in this calendar

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top