<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Whether a certain date/time is in the weekend</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.isset.html">IntlCalendar::isSet</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.roll.html">IntlCalendar::roll</a></div> <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="intlcalendar.isweekend" class="refentry"> <div class="refnamediv"> <h1 class="refname">IntlCalendar::isWeekend</h1> <p class="verinfo">(PHP 5.5.0, PECL >= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::isWeekend</span> — <span class="dc-title">Whether a certain date/time is in the weekend</span></p> </div> <div class="refsect1 description" id="refsect1-intlcalendar.isweekend-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>IntlCalendar::isWeekend</strong></span> ([ <span class="methodparam"><span class="type">float</span> <code class="parameter">$date</code><span class="initializer"> = NULL</span></span> ] )</div> <p class="para rdfs-comment"> Returns whether either the obejctʼs current time or the provided timestamp occur during a weekend in this objectʼs calendar system. </p> </div> <div class="refsect1 parameters" id="refsect1-intlcalendar.isweekend-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">date</code></em></span> <dd> <p class="para"> An optional timestamp representing the number of milliseconds since the epoch, excluding leap seconds. If <strong><code>NULL</code></strong>, this objectʼs current time is used instead. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-intlcalendar.isweekend-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> A <span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span> indicating whether the given or this objectʼs time occurs in a weekend. </p> <p class="para"> The value <strong><code>FALSE</code></strong> may also be returned on failure, for instance after giving a date out of bounds on non-lenient mode; use <a href="intl.configuration.html#ini.intl.use-exceptions" class="link">exceptions</a> or query <span class="function"><a href="function.intl-get-error-code.html" class="function">intl_get_error_code()</a></span> to disambiguate. </p> </div> <div class="refsect1 examples" id="refsect1-intlcalendar.isweekend-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2618"> <p><strong>Example #1 <span class="function"><strong>IntlCalendar::isWeekend()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'date.timezone'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Europe/Lisbon'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cal </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlGregorianCalendar</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #DD0000">'en_US'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #0000BB">2013</span><span style="color: #007700">, </span><span style="color: #0000BB">6 </span><span style="color: #FF8000">/* July */</span><span style="color: #007700">, </span><span style="color: #0000BB">7</span><span style="color: #007700">); </span><span style="color: #FF8000">// a Sunday <br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">isWeekend</span><span style="color: #007700">()); </span><span style="color: #FF8000">// true<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">isWeekend</span><span style="color: #007700">(</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">'2013-07-01 00:00:00'</span><span style="color: #007700">))); </span><span style="color: #FF8000">// false, Monday<br /><br /></span><span style="color: #0000BB">$cal </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlGregorianCalendar</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #DD0000">'ar_SA'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #0000BB">2013</span><span style="color: #007700">, </span><span style="color: #0000BB">6 </span><span style="color: #FF8000">/* July */</span><span style="color: #007700">, </span><span style="color: #0000BB">7</span><span style="color: #007700">); </span><span style="color: #FF8000">// a Sunday <br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">isWeekend</span><span style="color: #007700">()); </span><span style="color: #FF8000">// false, Sunday not in weekend in this calendar</span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-intlcalendar.isweekend-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="intlcalendar.getdayofweektype.html" class="methodname" rel="rdfs-seeAlso">IntlCalendar::getDayOfWeekType()</a> - Tell whether a day is a weekday, weekend or a day that has a transition between the two</span></li> <li class="member"> <span class="methodname"><a href="intlcalendar.getweekendtransition.html" class="methodname" rel="rdfs-seeAlso">IntlCalendar::getWeekendTransition()</a> - Get time of the day at which weekend begins or ends</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.isset.html">IntlCalendar::isSet</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.roll.html">IntlCalendar::roll</a></div> <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>