array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'intlcalendar.isweekend.php', 1 => 'IntlCalendar::isWeekend', 2 => 'Whether a certain date/time is in the weekend', ), 'up' => array ( 0 => 'class.intlcalendar.php', 1 => 'IntlCalendar', ), 'prev' => array ( 0 => 'intlcalendar.isset.php', 1 => 'IntlCalendar::isSet', ), 'next' => array ( 0 => 'intlcalendar.roll.php', 1 => 'IntlCalendar::roll', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/intl/intlcalendar/isweekend.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::isWeekend — Whether a certain date/time is in the weekend
Objektorientierter Stil
Prozeduraler Stil
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.
calendarEine IntlCalendar-Instanz.
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.
Bei einem Fehler wird auch false zurückgegeben. Um Fehlerzustände zu erkennen, kann die Funktion intl_get_error_code() verwendet werden oder Intl so konfiguriert werden, dass es Exceptions auslöst.
Beispiel #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