<!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>Tell whether a day is a weekday, weekend or a day that has a transition between the two</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getavailablelocales.html">IntlCalendar::getAvailableLocales</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.geterrorcode.html">IntlCalendar::getErrorCode</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.getdayofweektype" class="refentry"> <div class="refnamediv"> <h1 class="refname">IntlCalendar::getDayOfWeekType</h1> <p class="verinfo">(PHP 5.5.0, PECL >= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::getDayOfWeekType</span> — <span class="dc-title">Tell whether a day is a weekday, weekend or a day that has a transition between the two</span></p> </div> <div class="refsect1 description" id="refsect1-intlcalendar.getdayofweektype-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>IntlCalendar::getDayOfWeekType</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$dayOfWeek</code></span> )</div> <p class="para rdfs-comment"> Returns whether the passed day is a weekday (<strong><code>IntlCalendar::DOW_TYPE_WEEKDAY</code></strong>), a weekend day (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND</code></strong>), a day during which a transition occurs into the weekend (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong>) or a day during which the weekend ceases (<strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong>). </p> <p class="para"> If the return is either <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong> or <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong>, then <span class="function"><a href="intlcalendar.getweekendtransition.html" class="function">IntlCalendar::getWeekendTransition()</a></span> can be called to obtain the time of the transition. </p> <p class="para"> This function requires ICU 4.4 or later. </p> </div> <div class="refsect1 parameters" id="refsect1-intlcalendar.getdayofweektype-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">dayOfWeek</code></em></span> <dd> <p class="para"> One of the constants <strong><code>IntlCalendar::DOW_SUNDAY</code></strong>, <strong><code>IntlCalendar::DOW_MONDAY</code></strong>, …, <strong><code>IntlCalendar::DOW_SATURDAY</code></strong>. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-intlcalendar.getdayofweektype-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns one of the constants <strong><code>IntlCalendar::DOW_TYPE_WEEKDAY</code></strong>, <strong><code>IntlCalendar::DOW_TYPE_WEEKEND</code></strong>, <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_OFFSET</code></strong> or <strong><code>IntlCalendar::DOW_TYPE_WEEKEND_CEASE</code></strong> or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-intlcalendar.getdayofweektype-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2601"> <p><strong>Example #1 <span class="function"><strong>IntlCalendar::getDayOfWeekType()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #007700">foreach (array(</span><span style="color: #DD0000">'en_US'</span><span style="color: #007700">, </span><span style="color: #DD0000">'ar_SA'</span><span style="color: #007700">) as </span><span style="color: #0000BB">$locale</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"Locale: "</span><span style="color: #007700">, </span><span style="color: #0000BB">Locale</span><span style="color: #007700">::</span><span style="color: #0000BB">getDisplayName</span><span style="color: #007700">(</span><span style="color: #0000BB">$locale</span><span style="color: #007700">, </span><span style="color: #DD0000">"en_US"</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /> </span><span style="color: #0000BB">$cal </span><span style="color: #007700">= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #DD0000">'UTC'</span><span style="color: #007700">, </span><span style="color: #0000BB">$locale</span><span style="color: #007700">);<br /><br /> for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_SUNDAY</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700"><= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_SATURDAY</span><span style="color: #007700">; </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) {<br /> echo </span><span style="color: #0000BB">$i</span><span style="color: #007700">, </span><span style="color: #DD0000">" "</span><span style="color: #007700">, </span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">getDayOfWeekType</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">), </span><span style="color: #DD0000">" "</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">getDayOfWeekType</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">) >= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">DOW_TYPE_WEEKEND_OFFSET<br /> </span><span style="color: #007700">? </span><span style="color: #0000BB">$cal</span><span style="color: #007700">-></span><span style="color: #0000BB">getWeekendTransition</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)<br /> : </span><span style="color: #DD0000">''</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /> }<br /> echo </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}</span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> Locale: English (United States) 1 3 86400000 2 0 3 0 4 0 5 0 6 0 7 1 Locale: Arabic (Saudi Arabia) 1 0 2 0 3 0 4 0 5 1 6 3 86400000 7 0 </pre></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.getavailablelocales.html">IntlCalendar::getAvailableLocales</a></div> <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.geterrorcode.html">IntlCalendar::getErrorCode</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>