4 * Template Lite plugin converted from Smarty
5 * -------------------------------------------------------------
8 * Purpose: format datestamps via strftime
9 * Input: string: input date string
10 * format: strftime format for output
11 * default_date: default date if $string is empty
12 * -------------------------------------------------------------
15 function tpl_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
19 return strftime($format, tpl_make_timestamp($string));
21 elseif (isset($default_date) && $default_date != '')
23 return strftime($format, tpl_make_timestamp($default_date));
31 if(!function_exists('tpl_make_timestamp'))
33 function tpl_make_timestamp($string)
39 $time = strtotime($string);
40 if (is_numeric($time) && $time != -1)
45 // is mysql timestamp format of YYYYMMDDHHMMSS?
46 if (is_numeric($string) && strlen($string) == 14)
48 $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),substr($string,4,2),substr($string,6,2),substr($string,0,4));
52 // couldn't recognize it, try to return a time
53 $time = (int) $string;