<?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: Date countdown code in php</title>
	<atom:link href="http://www.theblog.ca/date-countdown-php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.theblog.ca/date-countdown-php</link>
	<description>Useful tips on Canada, cell phones, banking, technology, WordPress, PHP and more</description>
	<lastBuildDate>Fri, 10 Feb 2012 05:51:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: PN</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-16099</link>
		<dc:creator>PN</dc:creator>
		<pubDate>Mon, 27 Jun 2011 01:16:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-16099</guid>
		<description>Thanks for sharing this, just what I was looking for!</description>
		<content:encoded><![CDATA[<p>Thanks for sharing this, just what I was looking for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaco</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-15194</link>
		<dc:creator>Jaco</dc:creator>
		<pubDate>Thu, 13 Jan 2011 11:52:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-15194</guid>
		<description>Very nice!

Is it possible to convert this to a &quot;count-up&quot; counter as well?  I want to count down from today (eg. D-21) to a certain date (D)and then everyday upwards from there (D+x).  Any help would be much appreciated!

&lt;strong&gt;Reply from Peter: In the sample code, the $remain value will continue to go into the negative, so you could do a test on that and then output the absolute value of that as the &quot;count up&quot; value.&lt;/strong&gt;</description>
		<content:encoded><![CDATA[<p>Very nice!</p>
<p>Is it possible to convert this to a &quot;count-up&quot; counter as well?  I want to count down from today (eg. D-21) to a certain date (D)and then everyday upwards from there (D+x).  Any help would be much appreciated!</p>
<p><strong>Reply from Peter: In the sample code, the $remain value will continue to go into the negative, so you could do a test on that and then output the absolute value of that as the &#8220;count up&#8221; value.</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralph Frost</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-14764</link>
		<dc:creator>Ralph Frost</dc:creator>
		<pubDate>Sat, 13 Nov 2010 23:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-14764</guid>
		<description>Hey, very nice job!  Thank you.  I like the simplicity of (number of seconds at the future/event date minus the number of seconds right now).   

FWIW, I modified your function to cast from int to a string:  $remain = (string)$remain; and then return(ed) $remain; at the end of the function, which loaded it into a var by the calling function.    Then I used the string to write on an image with GD functions, fiddlingh with the x,y coordinates based on if  strlen($remain) was 2 or 1.     GD is a whole other difficult Sudoku puzzle, but  I got the thing to work.   Thanks again.</description>
		<content:encoded><![CDATA[<p>Hey, very nice job!  Thank you.  I like the simplicity of (number of seconds at the future/event date minus the number of seconds right now).   </p>
<p>FWIW, I modified your function to cast from int to a string:  $remain = (string)$remain; and then return(ed) $remain; at the end of the function, which loaded it into a var by the calling function.    Then I used the string to write on an image with GD functions, fiddlingh with the x,y coordinates based on if  strlen($remain) was 2 or 1.     GD is a whole other difficult Sudoku puzzle, but  I got the thing to work.   Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-14238</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 09 Sep 2010 01:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-14238</guid>
		<description>Hi Peter,

Yes, my mistake - &#039;fulfilment_day&#039; should have been in quotes! And you were right about the 29 characters being fishy - I didn&#039;t realize, but I was returning a &quot;formatted&quot; version of the string - so instead of:

$dayy = get_ept_field(&#039;fulfilment_day&#039;);

I had to use:

$dayy = get_ept_field(&#039;fulfilment_day&#039;, array(&#039;raw&#039; =&gt; &#039;true&#039;) );

which returned string(2) &quot;11&quot;, and could be passed correctly into your function!

Thanks so much for your help - I&#039;m sorry it wasn&#039;t more of an interesting problem rather than a snafu on my part. Still, I hope this can help someone in the future.</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>Yes, my mistake &#8211; &#8216;fulfilment_day&#8217; should have been in quotes! And you were right about the 29 characters being fishy &#8211; I didn&#8217;t realize, but I was returning a &quot;formatted&quot; version of the string &#8211; so instead of:</p>
<p>$dayy = get_ept_field(&#8216;fulfilment_day&#8217;);</p>
<p>I had to use:</p>
<p>$dayy = get_ept_field(&#8216;fulfilment_day&#8217;, array(&#8216;raw&#8217; =&gt; &#8216;true&#8217;) );</p>
<p>which returned string(2) &quot;11&quot;, and could be passed correctly into your function!</p>
<p>Thanks so much for your help &#8211; I&#8217;m sorry it wasn&#8217;t more of an interesting problem rather than a snafu on my part. Still, I hope this can help someone in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-14224</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 07 Sep 2010 06:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-14224</guid>
		<description>OK - I get it - it won&#039;t pass through because it is a string, not an integer. Although all attempts to make it an integer are returning false, which is a major bummer:

 $dayy = the_ept_field(fulfilment_day);
 var_dump($dayy); 

returns: string(29) &quot;10&quot;

 $dnum = (int)$dayy;
 var_dump($dnum);

returns: int(0)

(also returns 0 using intval($dayy) )

Any help is greatly appreciated! Hopefully this advice can help others looking to dynamically add dates to your function!

&lt;strong&gt;Reply from Peter: PHP is quite flexible, so in this case I don&#039;t think it makes a huge difference whether it&#039;s a string or an integer.  I&#039;m not sure what the issue is, although the fact that your original value is apparently 29 characters long suggests something fishy. Also, is &quot;fulfilment_day&quot; a string (in which case, it should be enclosed in quotes)?  A variable?&lt;/strong&gt;</description>
		<content:encoded><![CDATA[<p>OK &#8211; I get it &#8211; it won&#8217;t pass through because it is a string, not an integer. Although all attempts to make it an integer are returning false, which is a major bummer:</p>
<p> $dayy = the_ept_field(fulfilment_day);<br />
 var_dump($dayy); </p>
<p>returns: string(29) &quot;10&quot;</p>
<p> $dnum = (int)$dayy;<br />
 var_dump($dnum);</p>
<p>returns: int(0)</p>
<p>(also returns 0 using intval($dayy) )</p>
<p>Any help is greatly appreciated! Hopefully this advice can help others looking to dynamically add dates to your function!</p>
<p><strong>Reply from Peter: PHP is quite flexible, so in this case I don&#8217;t think it makes a huge difference whether it&#8217;s a string or an integer.  I&#8217;m not sure what the issue is, although the fact that your original value is apparently 29 characters long suggests something fishy. Also, is &#8220;fulfilment_day&#8221; a string (in which case, it should be enclosed in quotes)?  A variable?</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-14222</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 07 Sep 2010 03:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-14222</guid>
		<description>Awesome! This was very much what I was looking for! 
I&#039;m very new to PHP so I don&#039;t know the answer to this, but is it possible to pass a variable to the function call?

As in, I have some variables like $fd = get_ept_field(fulfilment_day)
and I want to pass those into function.

So I&#039;ve been doing something like 

countdown(&quot;Christmas Day&quot;, 12, (int)$fd, 2008); to call the function, but it just won&#039;t carry through to the actual function :(

You wouldn&#039;t happen to know where I&#039;ve gone wrong would you? 

In any case thanks for this function - I&#039;ve been looking for it everywhere!

&lt;strong&gt;Reply from Peter: Yes, that is definitely possible. Do a var_dump( $fd ); to check whether that variable contains what you think it does.&lt;/strong&gt;</description>
		<content:encoded><![CDATA[<p>Awesome! This was very much what I was looking for!<br />
I&#8217;m very new to PHP so I don&#8217;t know the answer to this, but is it possible to pass a variable to the function call?</p>
<p>As in, I have some variables like $fd = get_ept_field(fulfilment_day)<br />
and I want to pass those into function.</p>
<p>So I&#8217;ve been doing something like </p>
<p>countdown(&quot;Christmas Day&quot;, 12, (int)$fd, 2008); to call the function, but it just won&#8217;t carry through to the actual function <img src='http://www.theblog.ca/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>You wouldn&#8217;t happen to know where I&#8217;ve gone wrong would you? </p>
<p>In any case thanks for this function &#8211; I&#8217;ve been looking for it everywhere!</p>
<p><strong>Reply from Peter: Yes, that is definitely possible. Do a var_dump( $fd ); to check whether that variable contains what you think it does.</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mach37</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-10945</link>
		<dc:creator>Mach37</dc:creator>
		<pubDate>Sat, 02 May 2009 09:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-10945</guid>
		<description>Hey Cheersfor this code!!! ;) Great blog! 
I will do that into my image how many days remaining to school end :D</description>
		<content:encoded><![CDATA[<p>Hey Cheersfor this code!!! <img src='http://www.theblog.ca/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Great blog!<br />
I will do that into my image how many days remaining to school end <img src='http://www.theblog.ca/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Distorzija</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-10536</link>
		<dc:creator>Distorzija</dc:creator>
		<pubDate>Mon, 26 Jan 2009 14:50:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-10536</guid>
		<description>This is exactly what I need! Thanks for sharing, mate! Well done.</description>
		<content:encoded><![CDATA[<p>This is exactly what I need! Thanks for sharing, mate! Well done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crystal</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-10292</link>
		<dc:creator>Crystal</dc:creator>
		<pubDate>Fri, 05 Dec 2008 17:48:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-10292</guid>
		<description>I was looking for this exact code. Thank you very much!</description>
		<content:encoded><![CDATA[<p>I was looking for this exact code. Thank you very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip</title>
		<link>http://www.theblog.ca/date-countdown-php/comment-page-1#comment-10257</link>
		<dc:creator>Philip</dc:creator>
		<pubDate>Wed, 26 Nov 2008 22:23:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.theblog.ca/?p=35#comment-10257</guid>
		<description>Cheers for the code, worked great!</description>
		<content:encoded><![CDATA[<p>Cheers for the code, worked great!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

