<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Calculate the first Friday of next month with PHP</title>
	<atom:link href="http://www.chriskankiewicz.com/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chriskankiewicz.com/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/</link>
	<description>Web Design &#8226; Graphic Design &#8226; Code</description>
	<lastBuildDate>Wed, 16 Jun 2010 07:50:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: First Friday script updated and simplified &#124; Web Geek</title>
		<link>http://www.chriskankiewicz.com/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/comment-page-1/#comment-12</link>
		<dc:creator>First Friday script updated and simplified &#124; Web Geek</dc:creator>
		<pubDate>Sun, 15 Feb 2009 02:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-geek.net/?p=597#comment-12</guid>
		<description>[...] This is an update to the previous post found here: http://www.web-geek.net/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/ [...]</description>
		<content:encoded><![CDATA[<p>[...] This is an update to the previous post found here: <a href="http://www.web-geek.net/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/" rel="nofollow">http://www.web-geek.net/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: d3r1v3d</title>
		<link>http://www.chriskankiewicz.com/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/comment-page-1/#comment-11</link>
		<dc:creator>d3r1v3d</dc:creator>
		<pubDate>Tue, 21 Oct 2008 16:59:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-geek.net/?p=597#comment-11</guid>
		<description>Just for the hell of it, I wrote a script which does the same thing (I believe). Not sure how this is going be formatted once I post this, so I apologize in advance if it looks shitty:

&lt;pre lang=&quot;php&quot;&gt;&lt;?php
$date_today = getdate();

$timestamp_firstOfMonth =
    mktime($date_today[&#039;hours&#039;], $date_today[&#039;minutes&#039;], $date_today[&#039;seconds&#039;],
           $date_today[&#039;mon&#039;], 1, $date_today[&#039;year&#039;]);

$date_firstOfMonth = getdate($timestamp_firstOfMonth);

$date_firstFriday = array();
if ($date_firstOfMonth[&#039;wday&#039;] != 5)
{
    $dateOffset = 0;
    if ($date_firstOfMonth[&#039;wday&#039;] &lt; 5)
    {
        $dateOffset = 5 - $date_firstOfMonth[&#039;wday&#039;];
    }
    else
    {
        $dateOffset = 6;
    }

    $date_firstFriday = getdate(
        mktime($date_firstOfMonth[&#039;hours&#039;], $date_firstOfMonth[&#039;minutes&#039;], $date_firstOfMonth[&#039;seconds&#039;],
               $date_firstOfMonth[&#039;mon&#039;], ($date_firstOfMonth[&#039;mday&#039;] + $dateOffset), $date_today[&#039;year&#039;])
    );
}
else
{
    $date_firstFriday = $date_firstOfMonth;
}

echo &#039;This month, the meeting will take place on: &#039;
     . $date_firstFriday[&#039;year&#039;] . &#039;/&#039; . $date_firstFriday[&#039;mon&#039;] . &#039;/&#039; . $date_firstFriday[&#039;mday&#039;];
?&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Just for the hell of it, I wrote a script which does the same thing (I believe). Not sure how this is going be formatted once I post this, so I apologize in advance if it looks shitty:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$date_today</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getdate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$timestamp_firstOfMonth</span> <span style="color: #339933;">=</span>
    <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$date_today</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hours'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date_today</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'minutes'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date_today</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'seconds'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
           <span style="color: #000088;">$date_today</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mon'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date_today</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$date_firstOfMonth</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getdate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$timestamp_firstOfMonth</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$date_firstFriday</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wday'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$dateOffset</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wday'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$dateOffset</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wday'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$dateOffset</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$date_firstFriday</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getdate</span><span style="color: #009900;">&#40;</span>
        <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hours'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'minutes'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'seconds'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
               <span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mon'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$date_firstOfMonth</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mday'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$dateOffset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$date_today</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$date_firstFriday</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$date_firstOfMonth</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'This month, the meeting will take place on: '</span>
     <span style="color: #339933;">.</span> <span style="color: #000088;">$date_firstFriday</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'year'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$date_firstFriday</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mon'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$date_firstFriday</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mday'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: tintub</title>
		<link>http://www.chriskankiewicz.com/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/comment-page-1/#comment-10</link>
		<dc:creator>tintub</dc:creator>
		<pubDate>Tue, 21 Oct 2008 12:39:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-geek.net/?p=597#comment-10</guid>
		<description>I forgot to account for December (mod 12 = 0)

&lt;pre lang=&quot;php&quot;&gt;&lt;?php

$nextMonth = (date(&#039;n&#039;) + 2) % 12;
if ($nextMonth == 0) $nextMonth += 12;
$year = $nextMonth == 1 ? date(&#039;Y&#039;) + 1 : date(&#039;Y&#039;);
$firstDayOfNextMonth = date(&#039;N&#039;, mktime(0, 0, 0, $nextMonth, 1, $year));
echo &quot;First day of $nextMonth $year is $firstDayOfNextMonth\n&quot;;
$firstFriday = 6 - $firstDayOfNextMonth;
if ($firstFriday &lt;= 0) $firstFriday += 7;
echo &quot;First Friday falls on day $firstFriday\n&quot;;

?&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I forgot to account for December (mod 12 = 0)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$nextMonth</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'n'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$nextMonth</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$nextMonth</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$year</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$nextMonth</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> ? <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstDayOfNextMonth</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'N'</span><span style="color: #339933;">,</span> <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nextMonth</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$year</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;First day of <span style="color: #006699; font-weight: bold;">$nextMonth</span> <span style="color: #006699; font-weight: bold;">$year</span> is <span style="color: #006699; font-weight: bold;">$firstDayOfNextMonth</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstFriday</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$firstDayOfNextMonth</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstFriday</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$firstFriday</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;First Friday falls on day <span style="color: #006699; font-weight: bold;">$firstFriday</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: tintub</title>
		<link>http://www.chriskankiewicz.com/posts/2008/10/20/calculate-the-first-friday-of-next-month-with-php/comment-page-1/#comment-9</link>
		<dc:creator>tintub</dc:creator>
		<pubDate>Tue, 21 Oct 2008 12:34:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.web-geek.net/?p=597#comment-9</guid>
		<description>&lt;pre lang=&quot;php&quot;&gt;&lt;?php

$nextMonth = (date(&#039;n&#039;) + 1) % 12;
$year = $nextMonth == 1 ? date(&#039;Y&#039;) + 1 : date(&#039;Y&#039;);
$firstDayOfNextMonth = date(&#039;N&#039;, mktime(0, 0, 0, $nextMonth, 1, $year));
$firstFriday = 6 - $firstDayOfNextMonth;
if ($firstFriday &lt;= 0) $firstFriday += 7;
echo &quot;First Friday falls on day $firstFriday\n&quot;;

?&gt;&lt;/pre&gt;

(This code is untested for anything except current date btw)</description>
		<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$nextMonth</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'n'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$year</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$nextMonth</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> ? <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstDayOfNextMonth</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'N'</span><span style="color: #339933;">,</span> <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nextMonth</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$year</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$firstFriday</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$firstDayOfNextMonth</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstFriday</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$firstFriday</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;First Friday falls on day <span style="color: #006699; font-weight: bold;">$firstFriday</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>(This code is untested for anything except current date btw)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
