<?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: Calculating date difference more precisely in PHP</title>
	<atom:link href="http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/</link>
	<description>Web Development and Web Design Information Resources Helping You Build Great Websites!</description>
	<lastBuildDate>Sun, 29 May 2011 21:18:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-1743</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 11 Oct 2010 08:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-1743</guid>
		<description>How do we use this? Example function call?</description>
		<content:encoded><![CDATA[<p>How do we use this? Example function call?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John H</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-234</link>
		<dc:creator>John H</dc:creator>
		<pubDate>Sun, 16 May 2010 18:10:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-234</guid>
		<description>This script is incomplete. The switch case for months references undefined variables required for the calculation.</description>
		<content:encoded><![CDATA[<p>This script is incomplete. The switch case for months references undefined variables required for the calculation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeffery</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-223</link>
		<dc:creator>jeffery</dc:creator>
		<pubDate>Mon, 18 Jan 2010 07:49:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-223</guid>
		<description>great ...
this would work for me...

it saved me a lot of time....

thanks for sharing such a good code...</description>
		<content:encoded><![CDATA[<p>great &#8230;<br />
this would work for me&#8230;</p>
<p>it saved me a lot of time&#8230;.</p>
<p>thanks for sharing such a good code&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ventzy</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-222</link>
		<dc:creator>Ventzy</dc:creator>
		<pubDate>Sat, 09 Jan 2010 22:25:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-222</guid>
		<description>Indeed there is something missing on &quot;date(“j”, $dateto), date(“Y”, $datefrom)) 7)&quot;.
Does not work.</description>
		<content:encoded><![CDATA[<p>Indeed there is something missing on &#8220;date(“j”, $dateto), date(“Y”, $datefrom)) 7)&#8221;.<br />
Does not work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chand</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-221</link>
		<dc:creator>Chand</dc:creator>
		<pubDate>Wed, 25 Feb 2009 19:10:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-221</guid>
		<description>function get_time_difference( $start, $end )
{

	$uts[&#039;start&#039;] =$start;
	$uts[&#039;end&#039;] =$end;


	if( $uts[&#039;start&#039;]!=-1 &amp;&amp; $uts[&#039;end&#039;]!=-1 )
    {
        if( $uts[&#039;end&#039;] &gt;= $uts[&#039;start&#039;] )
        {
            $diff    =    $uts[&#039;end&#039;] - $uts[&#039;start&#039;];
            if( $days=intval((floor($diff/86400))) )
                $diff = $diff % 86400;
            if( $hours=intval((floor($diff/3600))) )
                $diff = $diff % 3600;
            if( $minutes=intval((floor($diff/60))) )
                $diff = $diff % 60;
            $diff    =    intval( $diff );
            return( array(&#039;days&#039;=&gt;$days, &#039;hours&#039;=&gt;$hours, &#039;minutes&#039;=&gt;$minutes, &#039;seconds&#039;=&gt;$diff) );
        }
        else
        {
            return -2;
			//trigger_error( &quot;Ending date/time is earlier than the start date/time&quot;, E_USER_WARNING );
        }
    }
    else
    {
        return -3;
		//trigger_error( &quot;Invalid date/time data detected&quot;, E_USER_WARNING );
    }
    return( false );
}</description>
		<content:encoded><![CDATA[<p>function get_time_difference( $start, $end )<br />
{</p>
<p>	$uts['start'] =$start;<br />
	$uts['end'] =$end;</p>
<p>	if( $uts['start']!=-1 &amp;&amp; $uts['end']!=-1 )<br />
    {<br />
        if( $uts['end'] &gt;= $uts['start'] )<br />
        {<br />
            $diff    =    $uts['end'] &#8211; $uts['start'];<br />
            if( $days=intval((floor($diff/86400))) )<br />
                $diff = $diff % 86400;<br />
            if( $hours=intval((floor($diff/3600))) )<br />
                $diff = $diff % 3600;<br />
            if( $minutes=intval((floor($diff/60))) )<br />
                $diff = $diff % 60;<br />
            $diff    =    intval( $diff );<br />
            return( array(&#8216;days&#8217;=&gt;$days, &#8216;hours&#8217;=&gt;$hours, &#8216;minutes&#8217;=&gt;$minutes, &#8216;seconds&#8217;=&gt;$diff) );<br />
        }<br />
        else<br />
        {<br />
            return -2;<br />
			//trigger_error( &#8220;Ending date/time is earlier than the start date/time&#8221;, E_USER_WARNING );<br />
        }<br />
    }<br />
    else<br />
    {<br />
        return -3;<br />
		//trigger_error( &#8220;Invalid date/time data detected&#8221;, E_USER_WARNING );<br />
    }<br />
    return( false );<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-220</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Sun, 08 Feb 2009 20:43:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-220</guid>
		<description>I&#039;m getting the same problem as Poly.  Any info on this?</description>
		<content:encoded><![CDATA[<p>I&#8217;m getting the same problem as Poly.  Any info on this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Poly</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-219</link>
		<dc:creator>Poly</dc:creator>
		<pubDate>Fri, 23 Jan 2009 08:51:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-219</guid>
		<description>Did not work on this line:

date(&quot;j&quot;, $dateto), date(&quot;Y&quot;, $datefrom))  7)

is this

date(&quot;j&quot;, $dateto), date(&quot;Y&quot;, $datefrom))==7)

or

date(&quot;j&quot;, $dateto), date(&quot;Y&quot;, $datefrom)) &lt; 7)

thanks</description>
		<content:encoded><![CDATA[<p>Did not work on this line:</p>
<p>date(&#8220;j&#8221;, $dateto), date(&#8220;Y&#8221;, $datefrom))  7)</p>
<p>is this</p>
<p>date(&#8220;j&#8221;, $dateto), date(&#8220;Y&#8221;, $datefrom))==7)</p>
<p>or</p>
<p>date(&#8220;j&#8221;, $dateto), date(&#8220;Y&#8221;, $datefrom)) &lt; 7)</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhinav</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-218</link>
		<dc:creator>abhinav</dc:creator>
		<pubDate>Mon, 07 Jul 2008 09:13:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-218</guid>
		<description>how to calculate the diffence between two dates stored in database mysql in the format yyyy-mm-dd (eg. 2008-09-12). date is stored in database in date datatype......
wating for a sooner reply</description>
		<content:encoded><![CDATA[<p>how to calculate the diffence between two dates stored in database mysql in the format yyyy-mm-dd (eg. 2008-09-12). date is stored in database in date datatype&#8230;&#8230;<br />
wating for a sooner reply</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ChaBi</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-217</link>
		<dc:creator>ChaBi</dc:creator>
		<pubDate>Mon, 23 Jun 2008 17:14:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-217</guid>
		<description>Did not work.</description>
		<content:encoded><![CDATA[<p>Did not work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akash Mehta</title>
		<link>http://www.developertutorials.com/tutorials/php/calculating-date-difference-more-precisely-in-php-71/comment-page-1/#comment-216</link>
		<dc:creator>Akash Mehta</dc:creator>
		<pubDate>Sun, 11 May 2008 08:16:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/#comment-216</guid>
		<description>@Rajeev: Thanks for the heads up. Actually, Hasin Hyder wrote this post, he was merely following on from a similar post I made on &quot;relative time&quot; (see http://www.developertutorials.com/blog/php/give-your-visitors-relative-y-php-69/). He will probably link the original post now that you have pointed it out, but I&#039;ll leave it up to him; the comments on that post are quite useful as well.</description>
		<content:encoded><![CDATA[<p>@Rajeev: Thanks for the heads up. Actually, Hasin Hyder wrote this post, he was merely following on from a similar post I made on &#8220;relative time&#8221; (see <a href="http://www.developertutorials.com/blog/php/give-your-visitors-relative-y-php-69/" rel="nofollow">http://www.developertutorials.com/blog/php/give-your-visitors-relative-y-php-69/</a>). He will probably link the original post now that you have pointed it out, but I&#8217;ll leave it up to him; the comments on that post are quite useful as well.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

