<?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 or Time Comparison in PHP</title>
	<atom:link href="http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/feed" rel="self" type="application/rss+xml" />
	<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html</link>
	<description>Useful Tutorials, Scripts , Tips, and Resources for all PHP and Ajax beginners and experts .</description>
	<lastBuildDate>Tue, 07 Feb 2012 08:10:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Tapan Kumar Thapa</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-6426</link>
		<dc:creator>Tapan Kumar Thapa</dc:creator>
		<pubDate>Fri, 18 Feb 2011 09:14:02 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-6426</guid>
		<description>Thanks it works...:-)

Regards
Tapan Thapa
India</description>
		<content:encoded><![CDATA[<p>Thanks it works&#8230;:-)</p>
<p>Regards<br />
Tapan Thapa<br />
India</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muneeb</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-5609</link>
		<dc:creator>Muneeb</dc:creator>
		<pubDate>Wed, 25 Aug 2010 09:29:13 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-5609</guid>
		<description>hi
 guys you can also use mysql for this purpose 
the query  SELECT TIMEDIFF(&#039;$Date1&#039; , &#039;$Date2&#039;) wil do the job
here is the link
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
also there are many other time and date manipulation functions in mysql you might want to check out on the link given above</description>
		<content:encoded><![CDATA[<p>hi<br />
 guys you can also use mysql for this purpose<br />
the query  SELECT TIMEDIFF(&#8216;$Date1&#8242; , &#8216;$Date2&#8242;) wil do the job<br />
here is the link<br />
<a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff" rel="nofollow">http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff</a><br />
also there are many other time and date manipulation functions in mysql you might want to check out on the link given above</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mayor sipayung</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-5522</link>
		<dc:creator>Mayor sipayung</dc:creator>
		<pubDate>Fri, 25 Jun 2010 16:31:37 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-5522</guid>
		<description>Thank you for the script</description>
		<content:encoded><![CDATA[<p>Thank you for the script</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheetal</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-5395</link>
		<dc:creator>Sheetal</dc:creator>
		<pubDate>Thu, 29 Apr 2010 17:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-5395</guid>
		<description>Could you please tell me either time is in 24 hr or in 12 hrs format?</description>
		<content:encoded><![CDATA[<p>Could you please tell me either time is in 24 hr or in 12 hrs format?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rebecca</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-4219</link>
		<dc:creator>Rebecca</dc:creator>
		<pubDate>Fri, 17 Jul 2009 05:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-4219</guid>
		<description>Thank you for the script. Unlike make scripts on the net, it compares the date, the month and the year. Its logically correct.</description>
		<content:encoded><![CDATA[<p>Thank you for the script. Unlike make scripts on the net, it compares the date, the month and the year. Its logically correct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IMF</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-4081</link>
		<dc:creator>IMF</dc:creator>
		<pubDate>Tue, 09 Jun 2009 16:59:19 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-4081</guid>
		<description>Looks good, I shall try it.</description>
		<content:encoded><![CDATA[<p>Looks good, I shall try it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cc</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-3469</link>
		<dc:creator>cc</dc:creator>
		<pubDate>Tue, 13 Jan 2009 02:11:33 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-3469</guid>
		<description>i think u dont have to do $start-$end  just do $start&gt;$end</description>
		<content:encoded><![CDATA[<p>i think u dont have to do $start-$end  just do $start&gt;$end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mann</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-2678</link>
		<dc:creator>Mann</dc:creator>
		<pubDate>Mon, 06 Oct 2008 12:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-2678</guid>
		<description>StartDate:10/08/2008

Enddate:06/10/2008
but the result is not correct</description>
		<content:encoded><![CDATA[<p>StartDate:10/08/2008</p>
<p>Enddate:06/10/2008<br />
but the result is not correct</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-902</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Sun, 18 May 2008 05:23:06 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-902</guid>
		<description>This function doesn&#039;t support the UK datetime format..and that&#039;s why you&#039;re getting improper result...it&#039;s beeter to have the date and time in &quot;YYYY-MM-DD&quot; format or &quot;YYYY-MM-DD HH:MM:SS&quot; format...</description>
		<content:encoded><![CDATA[<p>This function doesn&#8217;t support the UK datetime format..and that&#8217;s why you&#8217;re getting improper result&#8230;it&#8217;s beeter to have the date and time in &#8220;YYYY-MM-DD&#8221; format or &#8220;YYYY-MM-DD HH:MM:SS&#8221; format&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shels</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-896</link>
		<dc:creator>shels</dc:creator>
		<pubDate>Sat, 17 May 2008 15:49:43 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-896</guid>
		<description>If first date is 17/05/2008 and second date is 18/04/2008 
greaterDate($date1,$date2);
will display as 0. Meaning 17/05/2008 is less than 18/04/2008 which is wrong. It is comparing only the dates.</description>
		<content:encoded><![CDATA[<p>If first date is 17/05/2008 and second date is 18/04/2008<br />
greaterDate($date1,$date2);<br />
will display as 0. Meaning 17/05/2008 is less than 18/04/2008 which is wrong. It is comparing only the dates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-554</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Mon, 31 Mar 2008 18:50:37 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-554</guid>
		<description>No problem at all man...
when i tried with 
if(greaterDate(&#039;2007-10-10 09:15:27&#039;,&#039;2007-10-10 11:17:37&#039;))
   echo &quot;First parameter is greater&quot;;
else
   echo &quot;Second parameter is greater&quot;;

I got the result 
&quot;Second parameter is greater&quot;</description>
		<content:encoded><![CDATA[<p>No problem at all man&#8230;<br />
when i tried with<br />
if(greaterDate(&#8217;2007-10-10 09:15:27&#8242;,&#8217;2007-10-10 11:17:37&#8242;))<br />
   echo &#8220;First parameter is greater&#8221;;<br />
else<br />
   echo &#8220;Second parameter is greater&#8221;;</p>
<p>I got the result<br />
&#8220;Second parameter is greater&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vipin</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-552</link>
		<dc:creator>vipin</dc:creator>
		<pubDate>Mon, 31 Mar 2008 11:20:54 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-552</guid>
		<description>Hello,
I have observed that this function   
  
  if(greaterDate($date1,$date2))
   echo &quot;First parameter is greater&quot;;
  else
   echo &quot;Second parameter is greater&quot;;
  
work well for below values
 
    $date1=’2007-10-10 12:15:27?;
    $date1=’2007-10-10 11:17:37?;

but NOT for 

    $date1=’2007-10-10 9:15:27?;
    $date1=’2007-10-10 11:17:37?;

Please reply.</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I have observed that this function   </p>
<p>  if(greaterDate($date1,$date2))<br />
   echo &#8220;First parameter is greater&#8221;;<br />
  else<br />
   echo &#8220;Second parameter is greater&#8221;;</p>
<p>work well for below values</p>
<p>    $date1=’2007-10-10 12:15:27?;<br />
    $date1=’2007-10-10 11:17:37?;</p>
<p>but NOT for </p>
<p>    $date1=’2007-10-10 9:15:27?;<br />
    $date1=’2007-10-10 11:17:37?;</p>
<p>Please reply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anti Veeranna</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-39</link>
		<dc:creator>Anti Veeranna</dc:creator>
		<pubDate>Sun, 30 Dec 2007 17:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-39</guid>
		<description>damn, I don&#039;t get it :)&lt;br/&gt;&lt;br/&gt;I found this - http://bugs.php.net/bug.php?id=40691&lt;br/&gt;&lt;br/&gt;The sample code there gives expected response to me e.g. DateTime Equal? false&lt;br/&gt;&lt;br/&gt;And I&#039;m on php 5.2.4</description>
		<content:encoded><![CDATA[<p>damn, I don&#8217;t get it <img src='http://roshanbh.com.np/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I found this &#8211; <a href="http://bugs.php.net/bug.php?id=40691" rel="nofollow">http://bugs.php.net/bug.php?id=40691</a></p>
<p>The sample code there gives expected response to me e.g. DateTime Equal? false</p>
<p>And I&#8217;m on php 5.2.4</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anti Veeranna</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-38</link>
		<dc:creator>Anti Veeranna</dc:creator>
		<pubDate>Sun, 30 Dec 2007 17:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-38</guid>
		<description>Ok, I take it back. &lt;br/&gt;&lt;br/&gt;For some weird reason the code works. I get correct results when playing with the values, but this seems to be a simple side effect, there is nothing built into the datetime class to do that kind of comparisions, it is just a simple object instance comparision.</description>
		<content:encoded><![CDATA[<p>Ok, I take it back. </p>
<p>For some weird reason the code works. I get correct results when playing with the values, but this seems to be a simple side effect, there is nothing built into the datetime class to do that kind of comparisions, it is just a simple object instance comparision.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anti Veeranna</title>
		<link>http://roshanbh.com.np/2007/12/date-or-time-comparision-in-php.html/comment-page-1#comment-37</link>
		<dc:creator>Anti Veeranna</dc:creator>
		<pubDate>Sun, 30 Dec 2007 17:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/date-or-time-comparision-in-php/#comment-37</guid>
		<description>No you don&#039;t. Try this:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;$date1 = new Datetime(&#039;2007-11-10 12:15:27&#039;);&lt;br/&gt;$date2 = new Datetime(&#039;2007-10-10 12:15:27&#039;);&lt;br/&gt;$date3 = new Datetime(&#039;2007-10-10 11:15:27&#039;);&lt;br/&gt;$date4 = new Datetime(&#039;2007-10-10 12:15:27&#039;);&lt;br/&gt;&lt;br/&gt;if ($date2 &gt; $date1) {&lt;br/&gt;    print &quot;date2 is later than date1&quot;;&lt;br/&gt;} else {&lt;br/&gt;    print &quot;date1 is later than date2&quot;;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;print &quot;\n&quot;;&lt;br/&gt;&lt;br/&gt;if ($date3 &gt; $date4) {&lt;br/&gt;    print &quot;date3 is later than date4&quot;;&lt;br/&gt;} else {&lt;br/&gt;    print &quot;date4 is later than date3&quot;;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;print &quot;\n&quot;;&lt;br/&gt;&lt;br/&gt;[~]&gt; php date.php&lt;br/&gt;date1 is later than date2&lt;br/&gt;date4 is later than date3&lt;br/&gt;[~]&gt; php -v&lt;br/&gt;PHP 5.2.4 (cli) (built: Dec 16 2007 23:51:11)</description>
		<content:encoded><![CDATA[<p>No you don&#8217;t. Try this:</p>
<p>$date1 = new Datetime(&#8217;2007-11-10 12:15:27&#8242;);<br />$date2 = new Datetime(&#8217;2007-10-10 12:15:27&#8242;);<br />$date3 = new Datetime(&#8217;2007-10-10 11:15:27&#8242;);<br />$date4 = new Datetime(&#8217;2007-10-10 12:15:27&#8242;);</p>
<p>if ($date2 > $date1) {<br />    print &#8220;date2 is later than date1&#8243;;<br />} else {<br />    print &#8220;date1 is later than date2&#8243;;<br />}</p>
<p>print &#8220;\n&#8221;;</p>
<p>if ($date3 > $date4) {<br />    print &#8220;date3 is later than date4&#8243;;<br />} else {<br />    print &#8220;date4 is later than date3&#8243;;<br />}</p>
<p>print &#8220;\n&#8221;;</p>
<p>[~]> php date.php<br />date1 is later than date2<br />date4 is later than date3<br />[~]> php -v<br />PHP 5.2.4 (cli) (built: Dec 16 2007 23:51:11)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/19 queries in 0.286 seconds using disk: basic
Object Caching 404/405 objects using disk: basic

Served from: roshanbh.com.np @ 2012-02-09 05:57:47 -->
