<?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: PHP Pretty Date</title>
	<atom:link href="http://www.zachleat.com/web/php-pretty-date/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web/php-pretty-date/</link>
	<description></description>
	<lastBuildDate>Wed, 16 May 2012 21:15:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Zach Leatherman</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-2409</link>
		<dc:creator>Zach Leatherman</dc:creator>
		<pubDate>Mon, 11 Jul 2011 23:55:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-2409</guid>
		<description>Looking back on this script, I don&#039;t know that I&#039;d recommend using it.

It makes more sense to output UTC and then pretty it up using JavaScript instead.  Then you can cache your HTML.  See &lt;a href=&quot;http://www.zachleat.com/web/yet-another-pretty-date-javascript/&quot; rel=&quot;nofollow&quot;&gt;this implementation&lt;/a&gt;. Also &lt;a href=&quot;https://github.com/zachleat/Humane-Dates&quot; rel=&quot;nofollow&quot;&gt;on GitHub&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Looking back on this script, I don&#8217;t know that I&#8217;d recommend using it.</p>
<p>It makes more sense to output UTC and then pretty it up using JavaScript instead.  Then you can cache your HTML.  See <a href="http://www.zachleat.com/web/yet-another-pretty-date-javascript/" rel="nofollow">this implementation</a>. Also <a href="https://github.com/zachleat/Humane-Dates" rel="nofollow">on GitHub</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Woody</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-2408</link>
		<dc:creator>Woody</dc:creator>
		<pubDate>Mon, 11 Jul 2011 21:35:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-2408</guid>
		<description>Using in a new wordpress plugin, props dude, seems to fail for sub hours though...</description>
		<content:encoded><![CDATA[<p>Using in a new wordpress plugin, props dude, seems to fail for sub hours though&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin C.</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-2378</link>
		<dc:creator>Benjamin C.</dc:creator>
		<pubDate>Mon, 02 May 2011 16:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-2378</guid>
		<description>Thanks for the script!</description>
		<content:encoded><![CDATA[<p>Thanks for the script!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jelle</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-1878</link>
		<dc:creator>Jelle</dc:creator>
		<pubDate>Thu, 18 Feb 2010 11:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-1878</guid>
		<description>Support for future!

&lt;code&gt;

= 5.1 by Zach Leatherman (zachleat.com) 
// Slight modification denoted below to handle months and years. 
class prettydate 
{ 
    public static function getStringResolved($date, $compareTo = NULL) 
    { 
        if(!is_null($compareTo)) { 
            $compareTo = new DateTime($compareTo); 
        } 
        return self::getString(new DateTime($date), $compareTo); 
    } 

    public static function getString(DateTime $date, DateTime $compareTo = NULL) 
    { 
        if(is_null($compareTo)) { 
            $compareTo = new DateTime(&#039;now&#039;); 
        } 
        $diff = $compareTo-&gt;format(&#039;U&#039;) - $date-&gt;format(&#039;U&#039;); 
        $dayDiff = floor($diff / 86400); 
		
		if(is_nan($dayDiff)) return &#039;&#039;; 
		
		$end = &#039;ago&#039;;
		if($dayDiff &lt; 0) {	# date is in the future
			$end = &#039;left&#039;;
			$dayDiff *= -1;
		}

        if($dayDiff == 0) { 
            if($diff &lt; 60) { 
                return &#039;Just now&#039;; 
            } elseif($diff &lt; 120) { 
                return &#039;1 minute &#039;.$end; 
            } elseif($diff &lt; 3600) { 
                return floor($diff/60) . &#039; minutes &#039;.$end; 
            } elseif($diff &lt; 7200) { 
                return &#039;1 hour &#039;.$end; 
            } elseif($diff &lt; 86400) { 
                return floor($diff/3600) . &#039; hours &#039;.$end; 
            } 
        } elseif($dayDiff == 1) { 
            return &#039;Yesterday&#039;; 
        } elseif($dayDiff &lt; 7) { 
            return $dayDiff . &#039; days &#039;.$end; 
        } elseif($dayDiff == 7) { 
            return &#039;1 week &#039;.$end; 
        } elseif($dayDiff &lt; (7*6)) { // Modifications Start Here 
            // 6 weeks at most 
            return ceil($dayDiff/7) . &#039; weeks &#039;.$end; 
        } elseif($dayDiff &lt; 365) { 
            return ceil($dayDiff/(365/12)) . &#039; months &#039;.$end; 
        } else { 
            $years = round($dayDiff/365); 
            return $years . &#039; year&#039; . ($years != 1 ? &#039;s&#039; : &#039;&#039;) . &#039; &#039;.$end; 
        } 
    } 
}

&lt;code&gt;</description>
		<content:encoded><![CDATA[<p>Support for future!</p>
<p><code></p>
<p>= 5.1 by Zach Leatherman (zachleat.com)<br />
// Slight modification denoted below to handle months and years.<br />
class prettydate<br />
{<br />
    public static function getStringResolved($date, $compareTo = NULL)<br />
    {<br />
        if(!is_null($compareTo)) {<br />
            $compareTo = new DateTime($compareTo);<br />
        }<br />
        return self::getString(new DateTime($date), $compareTo);<br />
    } </p>
<p>    public static function getString(DateTime $date, DateTime $compareTo = NULL)<br />
    {<br />
        if(is_null($compareTo)) {<br />
            $compareTo = new DateTime('now');<br />
        }<br />
        $diff = $compareTo-&gt;format('U') - $date-&gt;format('U');<br />
        $dayDiff = floor($diff / 86400); </p>
<p>		if(is_nan($dayDiff)) return ''; </p>
<p>		$end = 'ago';<br />
		if($dayDiff &lt; 0) {	# date is in the future<br />
			$end = &#039;left&#039;;<br />
			$dayDiff *= -1;<br />
		}</p>
<p>        if($dayDiff == 0) {<br />
            if($diff &lt; 60) {<br />
                return &#039;Just now&#039;;<br />
            } elseif($diff &lt; 120) {<br />
                return &#039;1 minute &#039;.$end;<br />
            } elseif($diff &lt; 3600) {<br />
                return floor($diff/60) . &#039; minutes &#039;.$end;<br />
            } elseif($diff &lt; 7200) {<br />
                return &#039;1 hour &#039;.$end;<br />
            } elseif($diff &lt; 86400) {<br />
                return floor($diff/3600) . &#039; hours &#039;.$end;<br />
            }<br />
        } elseif($dayDiff == 1) {<br />
            return &#039;Yesterday&#039;;<br />
        } elseif($dayDiff &lt; 7) {<br />
            return $dayDiff . &#039; days &#039;.$end;<br />
        } elseif($dayDiff == 7) {<br />
            return &#039;1 week &#039;.$end;<br />
        } elseif($dayDiff &lt; (7*6)) { // Modifications Start Here<br />
            // 6 weeks at most<br />
            return ceil($dayDiff/7) . &#039; weeks &#039;.$end;<br />
        } elseif($dayDiff &lt; 365) {<br />
            return ceil($dayDiff/(365/12)) . &#039; months &#039;.$end;<br />
        } else {<br />
            $years = round($dayDiff/365);<br />
            return $years . &#039; year&#039; . ($years != 1 ? &#039;s&#039; : &#039;&#039;) . &#039; &#039;.$end;<br />
        }<br />
    }<br />
}</p>
<p></code><code></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jQuery Plugin: It&#8217;s CuteTime! &#171; The Product Guy</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-1697</link>
		<dc:creator>jQuery Plugin: It&#8217;s CuteTime! &#171; The Product Guy</dc:creator>
		<pubDate>Mon, 26 Oct 2009 13:45:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-1697</guid>
		<description>[...] there are other similar tools out there in JavaScript, PHP, and, I am sure, many other languages, none adequately met my goals. Therefore, I created the [...]</description>
		<content:encoded><![CDATA[<p>[...] there are other similar tools out there in JavaScript, PHP, and, I am sure, many other languages, none adequately met my goals. Therefore, I created the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devan</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-983</link>
		<dc:creator>Devan</dc:creator>
		<pubDate>Thu, 28 May 2009 15:31:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-983</guid>
		<description>This is great, i ran into a few issues with accurate yesterday handling, but i fixed them. you can see the fix here http://noise.weareplic.com/snippets/snippet-pretty-dates-php/30/

Loverly script.</description>
		<content:encoded><![CDATA[<p>This is great, i ran into a few issues with accurate yesterday handling, but i fixed them. you can see the fix here <a href="http://noise.weareplic.com/snippets/snippet-pretty-dates-php/30/" rel="nofollow">http://noise.weareplic.com/snippets/snippet-pretty-dates-php/30/</a></p>
<p>Loverly script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranie</title>
		<link>http://www.zachleat.com/web/php-pretty-date/comment-page-1/#comment-968</link>
		<dc:creator>Ranie</dc:creator>
		<pubDate>Fri, 24 Apr 2009 00:36:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2008/02/10/php-pretty-date/#comment-968</guid>
		<description>Thanks for this man! Was going to use the js version but I like the php better!</description>
		<content:encoded><![CDATA[<p>Thanks for this man! Was going to use the js version but I like the php better!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

