note 37242 added to ref.datetime
| From: | CodeDuck at gmx dot net | Date: | Fri, 07 Nov 2003 11:30:12 +0000 |
| Subject: | note 37242 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60070@lists.php.net to get a copy of this message | ||
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');
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.datetime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37242
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37242&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37242&report=yes
Search -- http://master.php.net/manage/user-notes.php