php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46788 date u format always shows 0's
Submitted: 2008-12-06 19:42 UTC Modified: 2008-12-09 14:16 UTC
From: neo_in_matrix at msn dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.7 OS: all
Private report: No CVE-ID: None
 [2008-12-06 19:42 UTC] neo_in_matrix at msn dot com
Description:
------------
date('u') always returns 0's, on Windows and Linux.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-06 19:56 UTC] pajoye@php.net
engine > date/time
 [2008-12-07 14:18 UTC] derick@php.net
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. Date internally only uses timestamps, which are signed *integers* and thus don't know anything about fractions.
 [2008-12-09 13:54 UTC] neo_in_matrix at msn dot com
Sorry... But I am quite curious about this 'problem'. Since date does not return useful value for 'u', what else functions use this format?
 [2008-12-09 13:58 UTC] derick@php.net
Like this:

$d = new DateTime("2008-12-09 14:57:55.25871");
echo $d->format( "u" );

echos:
258710

 [2008-12-09 14:16 UTC] bjori@php.net
Please read the docs: http://php.net/date

"Note: Since this function only accepts integer timestamps the u format character is only useful when using the date_format() function with user based timestamps created with date_create(). "
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 16:02:26 2025 UTC