Bug #60563 [Opn->Bgs]: strtotime(<float var>) returns TRUE
| From: | derick@php.net | Date: | Mon, 19 Dec 2011 12:12:32 +0000 |
| Subject: | Bug #60563 [Opn->Bgs]: strtotime(<float var>) returns TRUE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165968@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60563&edit=1
ID: 60563
Updated by: derick@php.net
Reported by: edu2004eu at yahoo dot com
Summary: strtotime(<float var>) returns TRUE
-Status: Open
+Status: Bogus
Type: Bug
Package: Date/time related
Operating System: Windows (at least)
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is correct. The float gets converted to a string ("0.8") and that is interpreted as
hour 0 and minute 8. Not every locale uses a : to separate, but some use the ".".
Previous Comments:
------------------------------------------------------------------------
[2011-12-19 11:32:04] edu2004eu at yahoo dot com
Description:
------------
I have a variable saved as float (checked with var_dump) and if I pass that
variable to "strtotime()", I get a valid timestamp. For example if my float
variable is "0.8", I would get "1324249680" as result from strtotime.
Not sure if this is normal, but I would say NO.
Test script:
---------------
echo strtotime(0.8);
$var = 0.8;
echo strtotime($var);
Expected result:
----------------
FALSE
Actual result:
--------------
1324249680
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60563&edit=1