<?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: Week list for the current date in PHP</title>
	<atom:link href="http://www.redips.net/php/week-list-current-date/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redips.net/php/week-list-current-date/</link>
	<description>Techniques and Web Technologies</description>
	<lastBuildDate>Sat, 04 Feb 2012 16:29:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/</generator>
	<item>
		<title>By: Jag</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4952</link>
		<dc:creator>Jag</dc:creator>
		<pubDate>Fri, 20 Jan 2012 20:36:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4952</guid>
		<description>Hi there im trying to display next week using same principle but it doesnt seem to be working :S..i have used 

$nextweek=date(&quot;d m Y&quot;, strtotime(&quot;next Week&quot;));

and same structure as above but does not work. 

any suggestion on how i can print next week ??

Thanks</description>
		<content:encoded><![CDATA[<p>Hi there im trying to display next week using same principle but it doesnt seem to be working :S..i have used </p>
<p>$nextweek=date("d m Y", strtotime("next Week"));</p>
<p>and same structure as above but does not work. </p>
<p>any suggestion on how i can print next week ??</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: waseem</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4557</link>
		<dc:creator>waseem</dc:creator>
		<pubDate>Mon, 17 Oct 2011 10:38:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4557</guid>
		<description>NICE !!!!!!!!!!!!     This is a very beautiful site.
my every problem solve about PHP to read tutorial</description>
		<content:encoded><![CDATA[<p>NICE !!!!!!!!!!!!     This is a very beautiful site.<br />
my every problem solve about PHP to read tutorial</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nadeem</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4542</link>
		<dc:creator>Nadeem</dc:creator>
		<pubDate>Tue, 11 Oct 2011 10:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4542</guid>
		<description>Thanx its Really Helpfull</description>
		<content:encoded><![CDATA[<p>Thanx its Really Helpfull</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dbunic</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4040</link>
		<dc:creator>dbunic</dc:creator>
		<pubDate>Wed, 15 Jun 2011 06:17:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4040</guid>
		<description>@Dean - OK, here is modified PHP code that will display current week and mark current date.
&lt;pre class=&quot;brush:php&quot;&gt;
$format = &#039;m/d/Y l&#039;;         // set Date format
$ts = time();                // set current Unix timestamp
$today = date($format, $ts); // set today
// find the year (ISO-8601 year number) and the current week
$year = date(&#039;o&#039;, $ts);
$week = date(&#039;W&#039;, $ts);
// print week for the current date
for($i = 1; $i &lt;= 7; $i++) {
    // timestamp from ISO week date format
    $ts = strtotime($year.&#039;W&#039;.$week.$i);
    // set day
    $day = date($format, $ts);
    // test if $day is $today
    if ($day == $today) {
        $flag = &#039; [today]&#039;;
    }
    else {
        $flag = &#039;&#039;;
    }
    // display result
    print $day . $flag . &quot;\n&quot;;
}
&lt;/pre&gt;

... and the result will be:


&lt;pre class=&quot;brush:text&quot;&gt;
06/13/2011 Monday
06/14/2011 Tuesday
06/15/2011 Wednesday [today]
06/16/2011 Thursday
06/17/2011 Friday
06/18/2011 Saturday
06/19/2011 Sunday
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Dean - OK, here is modified PHP code that will display current week and mark current date.</p>
<pre class="brush:php">
$format = 'm/d/Y l';         // set Date format
$ts = time();                // set current Unix timestamp
$today = date($format, $ts); // set today
// find the year (ISO-8601 year number) and the current week
$year = date('o', $ts);
$week = date('W', $ts);
// print week for the current date
for($i = 1; $i &lt;= 7; $i++) {
    // timestamp from ISO week date format
    $ts = strtotime($year.'W'.$week.$i);
    // set day
    $day = date($format, $ts);
    // test if $day is $today
    if ($day == $today) {
        $flag = ' [today]';
    }
    else {
        $flag = '';
    }
    // display result
    print $day . $flag . "\n";
}
</pre>
<p>... and the result will be:</p>
<pre class="brush:text">
06/13/2011 Monday
06/14/2011 Tuesday
06/15/2011 Wednesday [today]
06/16/2011 Thursday
06/17/2011 Friday
06/18/2011 Saturday
06/19/2011 Sunday
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dean</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4033</link>
		<dc:creator>Dean</dc:creator>
		<pubDate>Tue, 14 Jun 2011 21:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4033</guid>
		<description>Thanks. What I am trying to do is detect the current date, then display the days and dates for Monday through to Sunday for a timetable. I&#039;m a bit noob. :)</description>
		<content:encoded><![CDATA[<p>Thanks. What I am trying to do is detect the current date, then display the days and dates for Monday through to Sunday for a timetable. I'm a bit noob. <img src='http://www.redips.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dbunic</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4004</link>
		<dc:creator>dbunic</dc:creator>
		<pubDate>Fri, 10 Jun 2011 12:00:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4004</guid>
		<description>@Dean - This script will return whole week from Monday till Sunday for a given date. If you want to display (say Wednesday) it is enough to define $i=3 and to comment out the for loop. Something like this for the second example:
&lt;pre class=&quot;brush:php&quot;&gt;
$i = 3;
// print week for the current date
//for($i = 1; $i&lt; = 7; $i++) {
    // timestamp from ISO week date format
    $ts = strtotime($year.&#039;W&#039;.$week.$i);
    print date(&quot;m/d/Y l&quot;, $ts) . &quot;\n&quot;;
//}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Dean - This script will return whole week from Monday till Sunday for a given date. If you want to display (say Wednesday) it is enough to define $i=3 and to comment out the for loop. Something like this for the second example:</p>
<pre class="brush:php">
$i = 3;
// print week for the current date
//for($i = 1; $i&lt; = 7; $i++) {
    // timestamp from ISO week date format
    $ts = strtotime($year.&#039;W&#039;.$week.$i);
    print date(&quot;m/d/Y l&quot;, $ts) . &quot;\n&quot;;
//}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dean</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-4003</link>
		<dc:creator>Dean</dc:creator>
		<pubDate>Fri, 10 Jun 2011 11:03:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-4003</guid>
		<description>How can I display just one date for a chosen day?</description>
		<content:encoded><![CDATA[<p>How can I display just one date for a chosen day?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: santhosh</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-3747</link>
		<dc:creator>santhosh</dc:creator>
		<pubDate>Tue, 12 Apr 2011 07:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-3747</guid>
		<description>&lt;pre class=&quot;brush:php&quot;&gt;
$date = date(&#039;m/d/Y&#039;);
$ts = strtotime($date);
$dow = date(&#039;w&#039;, $ts);
$offset = $dow - 1;
if ($offset &lt; 0) {
    $offset = 6;
}
$ts = $ts - $offset*86400;
for ($i = 0; $i &lt; 7; $i++, $ts += 86400) {
    $data .= date(&quot; d&quot;, $ts);
}
$pieces = explode(&quot; &quot;, $data);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre class="brush:php">
$date = date('m/d/Y');
$ts = strtotime($date);
$dow = date('w', $ts);
$offset = $dow - 1;
if ($offset &lt; 0) {
    $offset = 6;
}
$ts = $ts - $offset*86400;
for ($i = 0; $i &lt; 7; $i++, $ts += 86400) {
    $data .= date(&quot; d&quot;, $ts);
}
$pieces = explode(&quot; &quot;, $data);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: santhosh</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-3746</link>
		<dc:creator>santhosh</dc:creator>
		<pubDate>Tue, 12 Apr 2011 07:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-3746</guid>
		<description>yes it&#039;s working thanks a lot</description>
		<content:encoded><![CDATA[<p>yes it's working thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan</title>
		<link>http://www.redips.net/php/week-list-current-date/comment-page-1/#comment-2538</link>
		<dc:creator>Stefan</dc:creator>
		<pubDate>Sun, 24 Oct 2010 17:10:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.redips.net/?p=64#comment-2538</guid>
		<description>thanks for this snippet! saved my week.. ;)</description>
		<content:encoded><![CDATA[<p>thanks for this snippet! saved my week.. <img src='http://www.redips.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

