note 37242 deleted from ref.datetime by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 17:41:22 +0000 |
| Subject: | note 37242 deleted from ref.datetime by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133187@lists.php.net to get a copy of this message | ||
Note Submitter: CodeDuck at gmx dot net
----
in reply to dkan at netscreen dot com 29-Aug-2003 07:40
> Zero-padding is easier to read and less complicated if you
> use the substr() function instead of an if-then statement.
my two versions of printtime with padding:
<?
function printtime() {
$timenow = getdate();
printf(
'%02d %02d %02d',
$timenow["hours"],
$timenow["minutes"],
$timenow["seconds"]
);
}
?>
or the better one:
<?
function printtime() {
echo date('H i s');
}
?>