php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37189 getdate doesn't work with a parameter
Submitted: 2006-04-25 04:45 UTC Modified: 2006-04-25 06:58 UTC
From: mlandis at pnmx dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.2 OS: Fedora Core 4
Private report: No CVE-ID: None
 [2006-04-25 04:45 UTC] mlandis at pnmx dot com
Description:
------------
Although getdate() works great without a parameter, it always produces:

Array ( [seconds] => 0 [minutes] => 0 [hours] => 18 [mday] => 31 [wday] => 3 [mon] => 12 [year] => 1969 [yday] => 364 [weekday] => Wednesday [month] => December [0] => 0 ) 

when given a parameter.

This PHP installation was configured with:
--with-pear --with-mysql --enable-safe-mode --enable-sockets --with-apxs2=...

Reproduce code:
---------------
// create a timestamp close to current time
$timeStamp = mktime( 23, 16, 52, 4, 24, 2006 );
echo "$timeStamp<br>\r\n";
$arr = getdate( $timestamp );
print_r( $arr );


Expected result:
----------------
something much closer to what you'd get without a parameter, e.g.

Array ( [seconds] => 16 [minutes] => 31 [hours] => 23 [mday] => 24 [wday] => 1 [mon] => 4 [year] => 2006 [yday] => 113 [weekday] => Monday [month] => April [0] => 1145939476 ) 

Actual result:
--------------
Array ( [seconds] => 0 [minutes] => 0 [hours] => 18 [mday] => 31 [wday] => 3 [mon] => 12 [year] => 1969 [yday] => 364 [weekday] => Wednesday [month] => December [0] => 0 ) 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-25 06:56 UTC] mike@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip

Not reproducible.
 [2006-04-25 06:58 UTC] mike@php.net
Oh, you've got a typo: $timestamp != $timeStamp.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 22:00:01 2026 UTC