PHP, MySQL DateTime & jQuery’s $.timeago

First off. I Love jQuery’s .timeago plugin developed by Ryan McGeary. Head over to Timeago’s website to see more about it. It’s simply a visual timestamp that changes to a relative timeframe in words, rather than having to work out constantly yourself. It’s a very common thing now some sites like Facebook ‘Posted 4 minutes ago’ etc. The only small hitch is printing to an ISO Format that is required for the Plugin. Mostly I use this in conjunction with a DATETIME MySQL field, I use the function below to convert it on the fly:

<br />
    /**<br />
     *   Expecting $timeString to have format of:<br />
     *      Y-m-d H:i:s (2013-10-04 08:57:00)<br />
    **/<br />
	public function ISOFormatTime( $timeString ) {<br />
       //Prevent PHP Notice date_default_timezone_set()<br />
<p>       //Formats an ISO-8601 date, pre-defined variable in date()<br />
	   return date( &quot;c&quot;, strtotime( $timeString ));<br />
    }<br />