Doc #55743 [Asn->Csd]: date u - Microseconds (added in PHP 5.2.2)

From: Date: Fri, 03 Aug 2012 01:57:09 +0000
Subject: Doc #55743 [Asn->Csd]: date u - Microseconds (added in PHP 5.2.2)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8684@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55743&edit=1 ID: 55743 Updated by: aharvey@php.net Reported by: bugzilla33 at gmail dot com Summary: date u - Microseconds (added in PHP 5.2.2) -Status: Assigned +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: All PHP Version: 5.4.0beta1 Assigned To: aharvey Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. I've handled this purely within the date() page — given that pretty much everything else is shared between date() and DateTime::format(), I don't really want to go down the path of splitting the reference across pages. Previous Comments: ------------------------------------------------------------------------ [2012-08-03 01:56:39] aharvey@php.net Automatic comment from SVN on behalf of aharvey Revision: http://svn.php.net/viewvc/?view=revision&revision=326951 Log: Clarify when the "u" format string actually does something useful, per doc bug #55743 (date u - Microseconds (added in PHP 5.2.2)). ------------------------------------------------------------------------ [2012-08-03 01:53:44] aharvey@php.net We can make this slightly clearer, I think. ------------------------------------------------------------------------ [2012-08-02 17:57:46] jsuprock at gmail dot com Hi Salathe, I suspected that this was the case based on the API for date() at php.net and the NOTE section. I'm not disagreeing, but my issue is mainly with the documentation... So here's the part where I feel like I need to put in my 2 cents, and I do appreciate your ears regardless of the outcome. (You have been great so far.) With respect to what the NOTE section states, it would probably make more sense to do the following: (1) Disable this formatting character for date() and gmdate(), and specifically remove the formatting character from the documentation on the date() page. (2) Update the DateTime::format() page with an explicit list of formatting characters including the "u". After all, the "u" format character is completely useless in the context of date(), and it really should not be allowed at all. I just think it causes more confusion is all...unless perhaps in the future all PHP date functions will accept microtime(true) (with a precision of 6) instead of time(). Sincerely, John ------------------------------------------------------------------------ [2012-08-02 14:21:49] salathe@php.net The "u" format character does work for date(), it always gives the correct answer of "000000" for this function. As explained here and on the date() page, date() itself works with whole seconds for the timestamp. If fractions of seconds are needed, use the DateTime class. Again, the document is correct since the "u" format character exists and does output the number of milliseconds for a given timestamp. However, that number will always be none since date() works with integers, i.e. whole seconds, only. ------------------------------------------------------------------------ [2012-08-02 14:03:28] jsuprock at gmail dot com Hi, I've experienced this as well, but I do follow your explanation. However, what is the reason for the documentation on this page still being incorrect? http://us2.php.net/manual/en/function.date.php It has been almost a year, and the page still suggests that the "u" formatter will work with date(). Thank you, John ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55743 -- Edit this bug report at https://bugs.php.net/bug.php?id=55743&edit=1

« previous php.doc.bugs (#8684) next »