9 * Include the {@link shared.make_timestamp.php} plugin
11 require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp');
13 * Smarty date_format modifier plugin
16 * Name: date_format<br>
17 * Purpose: format datestamps via strftime<br>
19 * - string: input date string
20 * - format: strftime format for output
21 * - default_date: default date if $string is empty
22 * @link http://smarty.php.net/manual/en/language.modifier.date.format.php
23 * date_format (Smarty online manual)
24 * @author Monte Ohrt <monte at ohrt dot com>
29 * @uses smarty_make_timestamp()
31 function smarty_modifier_date_format($string, $format = '%b %e, %Y', $default_date = '')
34 $timestamp = smarty_make_timestamp($string);
35 } elseif ($default_date != '') {
36 $timestamp = smarty_make_timestamp($default_date);
40 if (DIRECTORY_SEPARATOR
== '\\') {
41 $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
42 $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
43 if (strpos($format, '%e') !== false) {
45 $_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
47 if (strpos($format, '%l') !== false) {
49 $_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
51 $format = str_replace($_win_from, $_win_to, $format);
53 return strftime($format, $timestamp);
56 /* vim: set expandtab: */
This page took 0.841032 seconds and 4 git commands to generate.