php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39959 date "w" returns incorrect data
Submitted: 2006-12-26 23:50 UTC Modified: 2006-12-27 15:00 UTC
From: testingthis222 at hotmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.4.4 OS: unknown
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: testingthis222 at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-12-26 23:50 UTC] testingthis222 at hotmail dot com
Description:
------------
echo date("w",mktime(0,0,0,12,01,1933));

gives the wrong day
it returns 3 (=wednesday)

but it should be 5 (=friday)

?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-27 08:58 UTC] derick@php.net
Works for me:
derick@kossu:~$ php
<?php
echo date("w",mktime(0,0,0,12,01,1933));

?>
5

derick@kossu:~$ php -v
PHP 5.2.1RC2-dev (cli) (built: Dec 23 2006 20:56:19) (DEBUG)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

Which timezone is listed in phpinfo() output and what does "echo date_default_timezone_get();" output?
 [2006-12-27 14:29 UTC] testingthis222 at hotmail dot com
I'm sorry I seem to have posted it in the wrong version-thread.

My php version is 4.4.4.

echo date("w",mktime(0,0,0,12,01,1933));

returns 3 while it should be 5

(shouldn't it be 5 regardless of timezone?)

anyway; phpinfo() has no default TZ listed; and changing it to a US timezone doesn't change the output (still returns 3)


echo date_default_timezone_get();

seems to not be available in version 4.4.4.
 [2006-12-27 15:00 UTC] testingthis222 at hotmail dot com
should have used

$is_day=jddayofweek(cal_to_jd(CAL_GREGORIAN,$month,$day,$year),0)+1;

to dates prior to 1970 in version 4.4.4.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 17:05:45 2022 UTC