* Name: oos_date_short
* Version: 0.1
* Date: September 12, 2003
* Install: Drop into the plugin directory
*
* Examples: {$raw_date|oos_date_short}
* Author: r23
* -------------------------------------------------------------
*/
function smarty_modifier_oos_date_short($raw_date)
{
if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return FALSE;
$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);
if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {
return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
} else {
return preg_match('/2037' . '$/', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));
}
}