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:

     *   Expecting $timeString to have format of:
     *      Y-m-d H:i:s (2013-10-04 08:57:00)
	public function ISOFormatTime( $timeString ) {
       //Prevent PHP Notice date_default_timezone_set()

       //Formats an ISO-8601 date, pre-defined variable in date()
	   return date( "c", strtotime( $timeString ));