A pluggin to convert second in H:M:S
| From: | Juzan Jean-Michel | Date: | Tue, 25 Feb 2003 07:35:44 +0000 |
| Subject: | A pluggin to convert second in H:M:S | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8170@lists.php.net to get a copy of this message | ||
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: gethms
* Purpose: Convert second in H.M.S
* Usage: {gethms secondes=$TimeInSecond}
* -------------------------------------------------------------
*/
function smarty_function_gethms($params, &$smarty)
{
extract($params);
$hours = floor($secondes / 3600);
$minute = floor(($secondes - ($hours * 3600)) / 60);
$secconde = $secondes - ($hours * 3600) - ($minute * 60);
echo sprintf("%02d", $hours).".".sprintf("%02d",
$minute).".".sprintf("%02d", $secconde);
}
?>
--
Jean-Michel Juzan jmjuzan@ecreasol.ch
Direction Informations & Technologies
eCreaSol - NetWork Creative Solutions SARL - http://www.ecreasol.ch/
PGP public keys server : http://www.keyserver.net
Attachment: [application/pgp-signature] signature.asc
Attachment: [application/pgp-signature] signature.asc