<?php

/**
 * Snippet to format dates.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS\snippet\date
 * @copyright Copyright (c) 2012 - 2014 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

$date = new flDate(isset($time) ? $time : null, $tz = isset($tz) ? $tz : clearFusionCMS::getSysTimezone());

if(isset($timeSpan) && $timeSpan) {
	$d = new flDate(null, $tz);
	$span = $d->timeSpan($date);
	echo $span['string'];
}
else
	echo $date->toString(isset($format) ? $format : null);
