#47513 [NEW]: when using date, H shows 01 instead of 00
From: usrhlp at yahoo dot com
Operating system: Debian
PHP version: 5.2.8
PHP Bug Type: Date/time related
Bug description: when using date, H shows 01 instead of 00
Description:
------------
I am probably doing something wrong but I cannot for the life of me figure
out what it is.
I am trying to convert a small number to 24 hour time format. For example
I'm parsing the number 5 through the date function and I am receiving the
answer
01:00.05
I checked the PHP documentation and it shows as this for date()
H 24-hour format of an hour with leading zeros 00 through 23
According to the documentation 00 is a possible output of the H formatting
within date and should be what is coming out.
Reproduce code:
---------------
echo(date("H:i.s" ,1));
echo(date("H:i.s" ,10));
echo(date("H:i.s" ,100));
echo(date("H:i.s" ,1000));
echo(date("H:i.s" ,10000));
echo(date("H:i.s" ,100000));
echo(date("H:i.s" ,1000000));
echo(date("H:i.s" ,10000000));
Expected result:
----------------
time: 00:00.01
time: 00:00.10
time: 00:01.40
time: 00:16.40
time: 03:46.40
time: 04:46.40
time: 14:46.40
time: 18:46.40
Actual result:
--------------
time: 01:00.01
time: 01:00.10
time: 01:01.40
time: 01:16.40
time: 03:46.40
time: 04:46.40
time: 14:46.40
time: 18:46.40
--
Edit bug report at http://bugs.php.net/?id=47513&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47513&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47513&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47513&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47513&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47513&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47513&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47513&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47513&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47513&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47513&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47513&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47513&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47513&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47513&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47513&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47513&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47513&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47513&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47513&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47513&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47513&r=mysqlcfg
Thread (5 messages)
- usrhlp at yahoo dot com