Edit report at http://bugs.php.net/bug.php?id=53942&edit=1

 ID:                 53942
 Updated by:         dtajchre...@php.net
 Reported by:        jay_roplekar at hotmail dot com
 Summary:            Unexpected date("m",mktime_output) Output
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Date/time related
 Operating System:   Ubuntu
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

$tm = date('Y-m-d H:i:s');

$quarter = ceil(date("m", $tm)/3);



Your example doesn't make sense. The second parameter of date should be
a Unix 

timestamp... date('Y-m-d H:i:s') returned a formatted date string. Use
time(), 

mktime(), strtotime(), date("U"), or any number of the other functions
that 

return a Unix timestamp to create your $tm variable...


Previous Comments:
------------------------------------------------------------------------
[2011-02-06 22:35:05] jay_roplekar at hotmail dot com

Description:
------------
---

>From manual page: http://www.php.net/function.date

---

$tm = date('Y-m-d H:i:s');

$quarter = ceil(date("m", $tm)/3);

echo '<br> Current Quarter Is: '.$quarter.' Because date is:'.date("m",
$tm).' Time is:'.$tm.' month is:'.date("m").'<br>';



####

Output Below shows that  date("m", $tm) is producing wrong output, but
date("m") is producing correct output.  The PHP version is
5.2.10-2ubuntu6.5  but I believe that does not matter as the bug reports
I have reviewed don't talk about this behavior.

####



Current Quarter Is: 4 Because date is:12 Time is:2011-02-06 15:25:00
month is:02





------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53942&edit=1

Reply via email to