Return to Snippet

Revision: 4730
at January 18, 2008 06:37 by FrankBr


Initial Code
<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty convert to unix
 *
 * Type:     modifier
 * Name:     convertunix
 * Purpose:  convert unix timestamp to date
 * @author   Frank Broersen
 * @param string
 * @return string
 */
function smarty_modifier_convertunix($sString,$sFormat)
{
    return gmdate($sFormat, $sString);
}
?>

Initial URL

                                

Initial Description
A simple but usefull smarty plugin to convert a unix timestamp to any date format.

Usage: {$var|convertunix:"d-m-Y"}

Initial Title
Smarty: unix timestamp to date

Initial Tags
date, unix

Initial Language
PHP