Re: [SMARTY] date formatting
| From: | Peggy Schatz | Date: | Fri, 05 Oct 2007 07:57:11 +0000 |
| Subject: | Re: [SMARTY] date formatting | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13767@lists.php.net to get a copy of this message | ||
Yes, I used a simple plugin of my own:
function smarty_modifier_mydate_format($date_in,$lang)
{
if($date_in != "") {
$temp = explode("-",$date_in);
if($lang == "german") {
$date_out = $temp[2]. "." . $temp[1] . "." .$temp[0];
}
else {
$date_out = $temp[1]. "/" . $temp[2] . "/" .$temp[0];
}
return $date_out;
}
}
I'll take a look at PEAR::Date too, since PEAR is implemented anyway. Thanks!
Ciao,
Peggy
Another option is to override the built-in date_format function with your own plugin that has more robust date handling such as PEAR::Date. To override built-in plugins, you can add an entry to the beginning of the plugins_dir array: $tpl = new Smarty(); array_unshift($tpl->plugins_dir, '/my/plugins/dir/'); - Ken Snyder