|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-02-06 22:35 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 17:00:02 2025 UTC |
$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...